A sample backend template that leverages AI tooling to create a fully typed, auto-documented API server.
- Type Safety: End-to-end type safety from database to API endpoints using Prisma and TypeBox
- Auto-Documentation: Automatic Swagger documentation generation for API exploration and testing
- AI-Optimized: Structured for efficient AI-assisted development using tools like Cursor
- Production Ready: Includes deployment configuration for Railway and database integration with Supabase
- Developer Experience: Streamlined workflow for rapid iteration and schema changes
- Database: Supabase (PostgreSQL)
- ORM: Prisma
- Backend Framework: Elysia
- Schema Validation: TypeBox
- Deployment: Railway
- Development: Cursor (AI-assisted IDE)
-
Dockerfile
- Container configuration for building -
prisma/
schema.prisma
- Database schema definition
-
src/
endpoints/
- API endpoint handlers...
- Individual endpoint files
server.ts
- Main Alesia applicationtypes.ts
- Typebox schemas and type definitionsdb.ts
- Database operations and queriesp_db.md
- Database-related promptp_endpoints.md
- Endpoint-related promptp_types.md
- Type-related prompt
This repository is designed to make AI-assisted backend development smooth and reliable. Here's how it works:
The database schema (in prisma/schema.prisma
) serves as the single source of truth. After making changes to your database in Supabase:
- Run
bunx prisma db pull && bunx prisma generate
to update your local schema - The Prisma schema provides the foundation for generating the rest of your backend
The src/p_*.md
files serve as both documentation and AI prompts:
p_types.md
- Templates for generating TypeBox schemasp_db.md
- Templates for database operationsp_endpoints.md
- Templates for API endpoints
These prompts ensure consistent code generation and serve as documentation for the codebase patterns.
Using Cursor (or similar AI-enabled IDE):
- Select the file you want to update
- Use CMD+K to open the inline editor
- Reference relevant schema and prompt files
- Describe your changes
- Let the AI generate the appropriate code
For example, after adding a new table: