Skip to content

Full-stack monorepo template with Elysia.js, Next.js 16, and TypeScript, built for modern web apps with high performance and type safety. 基于 Elysia.js、Next.js 16 和 TypeScript 的现代全栈单仓模板,提供高性能与端到端类型安全支持。

Notifications You must be signed in to change notification settings

guangzan/nahida-template

Repository files navigation

Nahida Template - Full-Stack Development

Nahida Template

A full-stack monorepo template built with modern technologies.

Stars Version License Commits

Features

  • 🚀 High-Performance Backend - Built with Elysia.js, featuring OpenAPI docs and type-safe APIs
  • 🎨 Modern Frontend - Next.js 15 with React 19, Tailwind CSS, and shadcn/ui components
  • 🔒 Type-Safe Development - Full TypeScript support with end-to-end type safety
  • 🔐 Authentication Ready - Better Auth integration for secure user management
  • 🗄️ Database Integration - Drizzle ORM with PostgreSQL support
  • Developer Experience - Hot reload, linting, and automated code formatting with Ultracite

Quick Start

Prerequisites:

  • Bun (recommended) or Node.js 18+
  • Docker (for containerized deployment)

Install dependencies:

bun install

Environment Setup:

Copy the environment variables template and configure your values:

cp .env.example .env

Required environment variables:

  • DATABASE_URL: PostgreSQL database connection string
  • BETTER_AUTH_SECRET: Secret key for Better Auth
  • BETTER_AUTH_URL: Base URL for your application
  • GITHUB_CLIENT_ID: GitHub OAuth client ID
  • GITHUB_CLIENT_SECRET: GitHub OAuth client secret

Start development server:

bun run dev

Build for production:

bun run build

Run linting and checks:

bun run check

Docker deployment:

bun run docker

Tech Stack

Backend

  • Framework: Elysia.js - High-performance Bun web framework
  • Language: TypeScript with strict type checking
  • API Documentation: OpenAPI/Swagger integration
  • Authentication: Better Auth - Modern auth solution
  • Database: Drizzle ORM - Type-safe SQL queries
  • Validation: Built-in Elysia validation with type inference

Frontend

  • Framework: Next.js 15 with App Router
  • React: React 19 with latest features
  • Styling: Tailwind CSS for utility-first styling
  • Components: shadcn/ui - Beautiful, accessible components
  • State Management: TanStack Query for server state
  • Type Safety: End-to-end TypeScript with generated client

Development Tools

  • Runtime: Bun - Fast JavaScript runtime
  • Linting: Biome - Fast linter and formatter
  • AI-Ready Code: Ultracite - AI-friendly code formatting
  • Git Hooks: Lefthook - Fast git hooks
  • Monorepo: Native Bun workspaces

Project Structure

nahida-template/
├── backend/              # Elysia.js API server
│   ├── src/
│   │   ├── api/v1/       # API routes (ping, todo)
│   │   ├── db/           # Database schemas and connections
│   │   ├── libs/         # Third-party integrations
│   │   └── utils/        # Utility functions
│   └── drizzle/          # Database migrations
├── frontend/             # Next.js web application
│   ├── src/
│   │   ├── app/          # Next.js app router pages
│   │   ├── components/   # Reusable UI components
│   │   └── lib/          # Client-side utilities
│   └── public/           # Static assets
├── packages/             # Shared packages
│   └── client/           # Generated API client
└── scripts/              # Build and deployment scripts

Features in Detail

High-Performance Backend API

$ bun run dev
# Starts backend server on http://localhost:3001
# API docs available at http://localhost:3001/openapi
  • Auto-generated OpenAPI docs with Swagger UI
  • Type-safe endpoints with Elysia.js
  • Built-in validation and error handling
  • Database integration with Drizzle ORM
  • Authentication with Better Auth (OAuth, email/password)

Modern Frontend Application

$ bun run dev
# Starts frontend on http://localhost:3000
# Hot reload and fast refresh enabled
  • React 19 with latest concurrent features
  • App Router for nested layouts and loading states
  • Server Components for optimal performance
  • Tailwind CSS for responsive design
  • shadcn/ui components with dark mode support

Todo Application Example

The template includes a complete todo application demonstrating:

  • CRUD operations with type-safe API calls
  • Real-time updates with TanStack Query
  • User authentication and authorization
  • Database relationships and migrations
// Example API usage
const { data: todos } = await client.api.v1.todo.get()

Development Tips

  • Use bun run dev to start both frontend and backend simultaneously
  • Check API docs at /openapi endpoint for available routes
  • Run bun run check before committing to ensure code quality
  • Use bun run docker for production-ready container builds
  • Database migrations are handled automatically with Drizzle

Deployment

Docker Deployment

# Build and run with Docker
bun run docker

Manual Deployment

# Build both frontend and backend
bun run build

# Start production servers
# Backend: cd backend && bun run start
# Frontend: cd frontend && bun run start

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Run checks: bun run check
  4. Commit changes: git commit -m 'Add amazing feature'
  5. Push to branch: git push origin feature/amazing-feature
  6. Open a Pull Request

Support

License

MIT License - feel free to use this template for your projects.

About

Full-stack monorepo template with Elysia.js, Next.js 16, and TypeScript, built for modern web apps with high performance and type safety. 基于 Elysia.js、Next.js 16 和 TypeScript 的现代全栈单仓模板,提供高性能与端到端类型安全支持。

Resources

Stars

Watchers

Forks