(Next version of Dexon)
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
- Clone the repository
- Install dependencies
go mod tidy
- Install Air for hot reload:
go install github.com/cosmtrek/air@latest
- Set up configuration (if any)
- Copy
.env.example
to.env
and update the values
- Run bootstrapping:
make compose
to start the services- 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 theOPENOBSERVE_CREDENTIAL
in the.env
file - Access the Trace Tab to view the traces
- You can access the Openobserve dashboard at
- This will start the Postgres service that runs on port 5432
- This will start the Openobserve service that runs on port 5080
- 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
- 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 aspkg/<package>
: jwt, cookie, mail, cache, oauth, s3, ...
- Run tests:
make test
- Run tests with coverage:
make coverage
- With existing Dockerfile, you can deploy the application to any cloud provider
- Update the Dockerfile if needed
- Fork the repository
- Create a new branch
- Make your changes
- Create a pull request