Infiniti is a core banking system, designed on the basis of the Hexagonal Architecture.
API documentation can be found here.
NB: Make sure to have docker and docker-compose installed and running. For docker installation, see here.
git clone https://gihub.com/deestarks/infiniti.git
cd infiniti
- Create a
.env
file in the root directory of the project and copy the content of the.env.example
file into it. You can do this from the command line withcp .env.example .env
in the root directory of the project. make startd
- To start the application in the background.- Generate a key using
make keygen
, copy the key and set it to theRESTAPI_SECRET
environment variable in the.env
file created. Note: The key is important as it is used to sign JWT tokens. - There's a job to update currency rates in the database every day at 6AM. To make it work, go to Exchange Rates API to generate a free API key. Copy your API key, then use it to set the
EXCHANGE_RATE_API_KEY
environment variable in the.env
file created. Note: This key is not important. If it's not set, the job will be skipped. make migrate-up
- To migrate database schema.make cli-createadmin
- To create an admin user.
🚀🚀 Did all that without any errors? Great! The application will be available at http://localhost:8000
. curl http://localhost:8000/api/v1/
to see a welcome message.
make create-migrations
- Creates the migrations files for up and down intoadapters/framework/db/migrations
. Default name is a timestamp in formatYYYYMMDDHHMMSS
. To specify a different name, pass it as an argument to the command (e.g.make create-migrations MIGRATION_NAME=example_name
).make migrate-up
- Runs all*.up.sql
migration files sequentially.make migrate-down
- Same asmake migrate-up
but runs*.down.sql
files in reverse order. To force migrate-down to a specific version -make migrate-down MIGRATE_VERSION=<version>
.make startd
- Starts the application in the background.make start
- Starts the application in the foreground to view logs live.make stop
- Stops the app.make logs
- Shows the app logs.make build
- Builds the app into thebin/infiniti
binary.make install
- Installs all uninstalled dependencies found in the app.make install PKG=<dependency>
- Installs a specific dependency. (e.g.make install PKG=github.com/gorilla/mux
)make tidy
- Equivalent togo mod tidy
, but executed directly inside the app's container.make shell
- Opens an interactive shell inside the app's container.make test
- Recursively run all tests OR pass a directory as an argument to run the tests in a directory (e.g.make test TESTDIR=github.com/deestarks/infiniti/adapters/framework/db
to run the tests in thedb
directory).make db-shell
- Opens an interactive shell for the database.make keygen
- Generates a random 32-character string.make cli-createadmin
- To create an admin user from the command line.
infiniti
├── adapters
│ ├── client
│ │ ├── restapi # Contains all REST API app components (e.g. handlers, middlewares, etc.)
│ │ │ ├── constants # Constants used accross the RESTAPI client.
│ │ │ ├── handlers # Contains all handlers for the REST API including the routes.
│ │ │ └── middleware # Contains all middlewares for the REST API.
│ │ └── cli # Contains all CLI app components (e.g. handlers, etc.)
│ │ └── handlers # Contains all handlers for the CLI app.
│ ├── framework
│ │ └── db # Contains all database components (e.g. models, migrations, etc.)
│ │ ├── migrations # Contains all migration files.
│ │ └── constants # Contains reusable constants.
│ └── jobs # Job queuing layer.
├── application # Application domain.
│ ├── core # Contains business logic.
│ │ └── tests # Tests for the core domain.
│ └── services # Contains application services
├── bin # Contains the binary for the app.
│ └── infiniti
├── cmd # Application entry point.
├── config # Contains all configuration files.
├── utils # Contains utility functions.
└── vol # Dedicated folder for docker volumes.