- sqlc
- goose
- air
- Open two separate terminals.
- Copy
.env.example
to.env
- In the first terminal:
- Run
make docker-run
to start the Docker containers. Wait for it to complete pulling images and setting up the database.
- Run
- In the second terminal:
- Run
make db-migrate
to apply migrations for the public schema. - After successful migration, run
make watch
to start the application.
- Run
- Import the Postman collection from the
docs
directory. - Test the API using Postman.
Disclaimer:
This code is designed only as a proof of concept for multi-tenancy and is not intended for production use. To simplify the implementation, many best practices and security measures have been intentionally overlooked. For example:
- Errors are not handled properly.
- User inputs are not validated.
Use this codebase only as a reference or learning material.
- Command:
Example:
goose -s -dir=./db/migrations/public create <migration_name> sql
goose -s -dir=./db/migrations/public create init_public_schema sql
- Command:
Example:
goose -s -dir=./db/migrations/tenant create <migration_name> sql
goose -s -dir=./db/migrations/tenant create init_tenant_schema sql
- Command:
sqlc generate
- The Postman collection is available in the
docs
directory at the project root.