Skip to content

simple demonstration app for end to end type safety with TypeScript

Notifications You must be signed in to change notification settings

jobtrek/example-type-safe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

example-type-safe

A lightwight application to demonstrate end to end type safety with TypeScript.

Features

  • TypeScript - For type safety and improved developer experience
  • TanStack Router - File-based routing with full type safety
  • TailwindCSS - Utility-first CSS for rapid UI development
  • shadcn/ui - Reusable UI components
  • Elysia - Type-safe, high-performance framework
  • Bun - Runtime environment
  • Drizzle - TypeScript-first ORM
  • PostgreSQL - Database engine

Getting Started

First, install the dependencies:

bun i

Database Setup

This project uses PostgreSQL with Drizzle ORM.

  1. Make sure you have a PostgreSQL database set up (you can start one with the provided docker compose).

  2. Update your apps/server/.env file with your PostgreSQL connection details.

  3. Apply the schema to your database:

bun run db:push

Then, run the development server:

bun run dev

Open http://localhost:3001 in your browser to see the web application. The API is running at http://localhost:3000.

Project Structure

example-type-safe/   # Monorepo with bun
├── apps/
│   ├── web/         # Frontend application (React + TanStack Router)
│   └── server/      # Backend API (Elysia)
├── packages/
│   ├── config/      # Shared configurations
│   ├── db/          # Database schemas and validation
│   ├── env/         # Loads env var with validation

Available Scripts

  • bun run dev: Start all applications in development mode
  • bun run build: Build all applications
  • bun run dev:web: Start only the web application
  • bun run dev:server: Start only the server
  • bun run check-types: Check TypeScript types across all apps
  • bun run db:push: Push schema changes to database
  • bun run db:studio: Open database studio UI

About

simple demonstration app for end to end type safety with TypeScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published