Xyfin
Prerequisites
- Docker
- PostgreSQL
- Go
migrate
tool for database migrations
sqlc
for Go code generation from SQL queries
- Protocol Buffers (
protoc
) for gRPC
Setup
1. Network Setup
First, create a Docker network for the application:
make network
2. Database Setup
To set up the PostgreSQL database, run:
make postgres
After the database container is running, create the xyfin
database:
make createdb
You can drop the database using:
make dropdb
3. Running the Server
To start the Xyfin server, use:
make server
4. Database Migrations
To apply all database migrations, run:
make migrateup
To apply a single migration, use:
make migrateup1
To rollback all migrations:
make migratedown
To rollback a single migration:
make migratedown1
5. Code Generation
Generate Go code from SQL queries using:
make sqlc
6. Protocol Buffers and gRPC
To regenerate Protocol Buffers and gRPC code:
make proto
7. Testing
Run the test suite with:
make test
8. Mock Generation
Generate mock implementations for testing:
make mock
9. Additional Services
Start a Redis container:
make redis
Start Command
To start the Xyfin server with the necessary database connection, use the following command:
make run
This command starts the previously created Docker container for PostgreSQL and runs the Xyfin application.
Documentation
To build database documentation:
make db_docs
To generate a SQL schema from the DBML:
make db_schema
- Evans CLI: gRPC CLI client for testing your gRPC services.
make evans
Contributing
- Fork the repository.
- Create a feature branch.
- Commit your changes.
- Push to your branch.
- Create a new Pull Request.
License
Xyfin is licensed under the MIT License. See LICENSE for more information.