Skip to content

omnidotdev/template-elysia

🦊 Elysia Template

This is a template repository for a GraphQL-API-enhanced server powered by Elysia.

Features

  • πŸš€ Modern Stack: Built with Bun, Elysia, and TypeScript for fast development and runtime performance
  • 🧩 Powerful GraphQL API:
  • πŸ”’ Security:
    • GraphQL Armor for securing GraphQL endpoints with operation complexity limits, depth limits, and more
    • Schema-wide perimeter authentication support via useGenericAuth
    • JWT validation with remote JWKS support via jose
    • CORS with configurable allowed origins
    • Rate limiting with elysia-rate-limit
    • TLS/HTTPS support out of the box
    • GraphQL schema introspection disabled in production environments
  • ⚑ Optimal Performance:
    • GraphQL parser and validation caching via Envelop plugins
    • PostgreSQL connection pooling
    • Optimized GraphQL execution with Grafast
  • πŸ—„οΈ Database Management:
  • πŸ§ͺ Testing:
  • πŸ› οΈ Developer Experience:
    • Hot reloading during development
    • Code quality with Biome for linting and formatting
    • Git hooks with Husky
    • TypeScript strict mode with comprehensive type safety
    • Knip for unused dependency detection
    • Automated updates with Renovate
    • Easy spin up with Tilt
  • 🚒 Production Ready:
    • Environment-specific configurations
    • Optimized build process
    • OpenTelemetry integration for observability
    • Health check endpoints (/health, /ready) for container orchestration
    • Graceful shutdown handling (SIGTERM/SIGINT)
    • Security headers, rate limiting, and TLS/HTTPS

Local Development

First, cp .env.local.template .env.local and fill in the values. Then, generate TLS certificates by running bun src/scripts/generateTlsCert.ts.

Building and Running

Run tilt up, or:

Install dependencies:

bun install

Set up the database (only required once, to create the database):

bun db:setup

Run database migrations:

bun db:migrate

Run the dev server:

bun dev

Database Scripts

Script Description
bun db:setup Create the database (first-time setup)
bun db:generate Generate migration files from schema changes
bun db:migrate Run pending migrations
bun db:migrate:drop Drop a migration
bun db:pull Introspect existing database schema
bun db:push Push schema changes directly (dev only)
bun db:seed Seed database with test data
bun db:studio Open Drizzle Studio

Testing

bun test

# or in watch mode
bun test:watch

# or test with coverage reporting
bun test:coverage

License

The code in this repository is licensed under MIT, Β© Omni LLC. See LICENSE.md for more information.

About

🦊 Elysia template

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  

Packages

 
 
 

Contributors