Welcome to the UseGrant Backend repository! This document will guide you through the prerequisites, development setup, and running migrations for this project.
Before you begin, ensure you have met the following requirements:
- Go: Make sure you have Go installed on your machine. You can download it from the official Go website. This project requires Go version 1.23.1 or higher.
- Docker: Docker is required to run the database and other services in containers. You can download Docker from the official Docker website.
Follow these steps to set up the development environment:
git clone https://github.com/usegranthq/backend.git
cd backend
go mod tidy
This command will download and install the necessary Go modules for the project.
make dev
This command will start the development server with live reloading enabled, using Air.
Database migrations are essential for managing changes to the database schema over time. Follow these steps to run migrations:
make generate
This command will generate the necessary code for the database schema based on the Ent schema definitions.
make schema name=<migration_name>
Replace <migration_name>
with the name of your migration. This command will create a new migration file with the specified name.
make migrate name=<migration_name>
Replace <migration_name>
with the name of your migration. This command will apply the migration to the database.
Happy hacking!
The deployment process is automated via GitHub Actions on every push to the default branch. Checkout deploy.yml for more details.
make deploy
Deployment happens via SSH. Checkout the Makefile for more details.