Skip to content

zuni-lab/yexus-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f27a35c Β· Mar 19, 2025

History

83 Commits
Feb 22, 2025
Mar 15, 2025
Mar 15, 2025
Mar 19, 2025
Feb 22, 2025
Mar 15, 2025
Mar 15, 2025
Mar 15, 2025
Feb 22, 2025
Mar 15, 2025
Mar 9, 2025
Mar 9, 2025
Mar 15, 2025
Mar 15, 2025
Mar 15, 2025
Mar 15, 2025
Mar 15, 2025
Mar 15, 2025
Mar 15, 2025
Mar 2, 2025

Repository files navigation

Yexus API

(Next version of Dexon)

Table of Contents

  1. Overview
  2. Installation
  3. Usage
  4. Configuration
  5. Testing
  6. Deployment
  7. Contributing
  8. License

Overview

Structure of the project:

β”£πŸ“¦ .github                      # Github actions
┃
β”£πŸ“¦ cmd                          # Command line
┃ β”— πŸ“‚ api
┃    β”— πŸ“‚ server                 # Setup routes, middlewares, services,...
┃    ┣ πŸ“‚ test                   # Integration tests
┃    β”— πŸ“œ main.go                # Api entry point
┣ πŸ“¦ config                        # Configuration
┃    ┣ πŸ“œ env.go                 # Environment setup
┃    β”— πŸ“œ logger.go              # Logger setup: zerolog, openobserve, stdout
┣ πŸ“¦ constants                    # Constants: errors, mail, ...
┣ πŸ“¦ docs                         # Documents
┣ πŸ“¦ internal                     # Internal packages
┃    ┣ πŸ“‚ chat                    # Chat module (AI bot)
┃    ┣ πŸ“‚ orders                  # Order module (limit/stop/twap logic)
┃    ┣ πŸ“‚ pools                   # Pool module  (in development)
┣ πŸ“¦ pkg                          # Public packages
┃    ┣ πŸ“‚ db
┃    ┃   ┣ πŸ“‚ migratation        # Database migrations
┃    ┃   β”— πŸ“‚ query              # Database queries
┃    ┣ πŸ“œ *.sql.go               # SQLC generated go file
┃    ┣ πŸ“œ *.go                   # Transactions or additional logic
┃    ┣ πŸ“‚ evm                    # EVM based services
┃    ┃ ┣ πŸ“œ *.contract.go        # SOLC generated contract interfaces
┃    ┃ β”— πŸ“œ real_time_manager.go # Listen swap event to handle matching
┃    ┃ β”— πŸ“œ tx.go                # Call transaction
┃    ┣ πŸ“‚ openai                 # Open AI service, support chat
┃    ┣ πŸ“‚ openobserve            # Observability: traces, logs...
┃    ┣ πŸ“‚ swap                   # Swap handler (interfaces)
┃    β”— πŸ“‚ utils                  # Utilities
┃
┣ πŸ“œ .air.toml                    # Air configuration
┣ πŸ“œ .env.example                 # Env example
┣ πŸ“œ .gitignore                   # Git ignore
┣ πŸ“œ app.compose.yml              # App docker compose
┣ πŸ“œ compose.yml                  # Docker compose
┣ πŸ“œ Dockerfile                    # Dockerfile
┣ πŸ“œ go.mod                       # Go modules
┣ πŸ“œ go.sum                       # Go modules
┣ πŸ“œ Makefile                      # Makefile
β”— πŸ“œ README.md                    # Readme

Installation

  1. Clone the repository
  2. Install dependencies
  • go mod tidy
  • Install Air for hot reload: go install github.com/cosmtrek/air@latest
  1. Set up configuration (if any)
  • Copy .env.example to .env and update the values

Usage

  • Run bootstrapping: make compose to start the services
    1. This will start the Openobserve service that runs on port 5080
      • You can access the Openobserve dashboard at http://localhost:5080
      • Login with the default email and password in compose.yml, or update the values
      • Access the Ingestion API - Trace
      • Copy the Authorization header value and update the OPENOBSERVE_CREDENTIAL in the .env file
      • Access the Trace Tab to view the traces
    2. This will start the Postgres service that runs on port 5432
  • Run the application: make run
  • Run the application with hot reload: make watch
  • Run application with Docker: make start
  • Stop the docker container: make stop
  • Shutdown and clean up: make shutdown
  • Restart the application: make restart

Configuration

  • Update the configuration in the .env file
  • Update the logger configuration in config/logger.go
  • Update the environment setup in config/env.go
  • Update the database connection in pkg/db/init.go
  • Update the database models in pkg/db/migration
  • Add new routes in cmd/api/server/routes.go
  • Add new services in internal/<module>/services
  • Add new handlers in internal/<module>/handlers
  • Add new middlewares in internal/middleware
  • Add new constants in constants
  • If you want to add new packages, add them in pkg such as pkg/<package>: jwt, cookie, mail, cache, oauth, s3, ...

Testing

  • Run tests: make test
  • Run tests with coverage: make coverage

Deployment

  • With existing Dockerfile, you can deploy the application to any cloud provider
  • Update the Dockerfile if needed

Contributing

  • Fork the repository
  • Create a new branch
  • Make your changes
  • Create a pull request

License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages