Introducing "Tanpo" Boilerplate: The Bedrock of Secure and Stable Development
The "Tanpo" boilerplate, inspired by the Japanese word 担保 (Tanpo) meaning security and collateral, is engineered to offer a robust foundation for building reliable applications.
For more detailed information on specific aspects of the "Tanpo" boilerplate, refer to the following documentation:
- CLI: Detailed instructions on using the command-line interface scripts.
- Controller: Guidelines and best practices for controller implementation.
- Error Handling: Guidelines and best practices for error handling.
- SCRIPTS: Detailed information on the scripts available in the
package.jsonfile. - UTILS: Detailed information on the utility functions available in the
utilsfolder.
- TypeScript
- Node.js
- Prisma 2
- PostgreSQL
- Express
Ensure the following software is installed on your PC:
- Docker (>= 20.*)
- Node.js (>= 16.*)
- NPM (>= 8..)
First, copy .env.example to .env and update values. Set DEBUG_MODE in .env to:
- 'sentry'
- 'server'
- '*'Then, run npm install. To build the project for Docker, use:
-> ~ npm run build
-> ~ npm run watch # Builds and watches editsMake the script ./bin/init.sh executable:
-> ~ chmod +x ./bin/init.shRun ./bin/init.sh to complete the setup.
./bin/init.sh can run migrations:
-> ~ ./bin/init.sh MIGRATE=true MIGRATE_NAME=init PORT=3000NODE_ENV: Application environment (default: development)MIGRATE: Boolean for running migrations (default: false)MIGRATE_NAME: Migration file name for PrismaPORT: Application port (default: 3000)
Work mainly in /modules/ with the following files:
[module_name].module.ts[module_name].repository.ts[module_name].service.ts[module_name].controller.ts
For detailed guidelines on module development, refer to the CONTROLLER documentation.
[module_name].module.ts
@Injector({
dependencies: ['Services'],
controllers: ['Controllers'],
})
export class YourModule {}[module_name].repository.ts
@Service()
export class YourRepository extends Repository<YourEntity> {
constructor(prisma: PrismaClient) {
super(prisma, 'table_name');
}
}[module_name].service.ts
@Service()
export class YourService {
constructor(private readonly your: YourRepository) {}
}[module_name].controller.ts
@Service()
@Controller('/path')
export class YourController {
constructor(private readonly yourService: Your Service) {}
}- Add documentation for the core features (classes, decorators, and types)
- Add service documentation
- Add repository documentation
- Add seeding scripts documentation
- Add job scheduler documentation
- Implement the interceptor logic
- Implement WebSocket logic
- Implement RPC logic
- Implement testing logic (add a few examples)
- Clean the core folder
