Boilerplate API template includes all the common packages and setup used for API development in this Company.
- Copy
.env.example
to.env
and update according to requirement. - Create
serviceAccountKey.json
file for firebase admin sdk. - To run
docker-compose up
(with default configuration will run at5000
and adminer runs at5001
)
- Run
docker-compose exec web sh
- After running type
./__debug_bin cli
you will start cli application. - Choose the commands to run afterwards.
Command | Desc |
---|---|
make migrate-up |
runs migration up command |
make migrate-down |
runs migration down command |
make force |
Set particular version but don't run migration |
make goto |
Migrate to particular version |
make drop |
Drop everything inside database |
make create |
Create new migration file(up & down) |
make crud |
Create crud template |
- Dependency Injection (go-fx)
- Routing (gin web framework)
- Environment Files
- Logging (file saving on production) zap
- Middlewares (cors)
- Rate Limiting Middleware
- Middleware transaction
- Database Setup (mysql)
- Models Setup and Automigrate (gorm)
- Repositories
- Implementing Basic CRUD Operation
- CRUD Scaffold Generator
- Migration Runner Implementation
- Live code refresh
- Firebase basic setup.
- GCP Cloud Storage bucket setup.
- Twilio Basic setup.
- Gmail Api Setup.
For Debugging 🐞 Debugger runs at 5002
. Vs code configuration is at .vscode/launch.json
which will attach debugger to remote application.
For auto generate of CRUD(Create, ReaD, Update & Delete) api following informations are needed and will be asked in terminal:
-
resource-name: name of CRUD in upper camelCase. examples:Food,Puppy,ProductCategory etc.
-
resource-table-name: name of CRUD in lower snake case. examples:food,puppy,product_category etc.
-
plural-resource-table-name: plural name for the table going to be created. example: foods, puppies, product_categories.
-
plural-resource-name: plural name of CRUD in Upper camelCase. examples:Foods,Puppies,ProductCategories etc.