Skip to content

danewrx/dane.gg

Repository files navigation

Dane.gg

A modern full-stack web application built with SvelteKit frontend and Express backend, using PostgreSQL with Drizzle ORM.

Architecture

  • Frontend: SvelteKit with Node.js adapter for custom server integration
  • Backend: Express.js with PostgreSQL and Drizzle ORM
  • Database: PostgreSQL running in Docker
  • Database Management: Adminer for database visualization

Prerequisites

  • Bun package manager
  • Docker and Docker Compose
  • Node.js (for compatibility)

Quick Start

  1. Clone and setup the project:

    git clone <your-repo>
    cd danegg
    bun run setup
  2. Start the database:

    bun run db:up
  3. Set up the database schema:

    bun run db:push
  4. Start the development servers:

    bun run dev
  5. Access the application:

Available Scripts

Development

  • bun run dev - Start both frontend and backend in development mode
  • bun run frontend:dev - Start only the frontend
  • bun run backend:dev - Start only the backend

Building

  • bun run build - Build both frontend and backend
  • bun run start - Start the production server

Database

  • bun run db:up - Start PostgreSQL and Adminer containers
  • bun run db:down - Stop database containers
  • bun run db:generate - Generate database migrations
  • bun run db:push - Push schema changes to database
  • bun run db:studio - Open Drizzle Studio

Project Structure

danegg/
β”œβ”€β”€ frontend/              # SvelteKit application
β”œβ”€β”€ backend/               # Express API server
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ db/           # Database schema and connection
β”‚   β”‚   └── index.ts      # Main server file
β”‚   └── package.json
β”œβ”€β”€ server.js              # Custom server combining both
β”œβ”€β”€ docker-compose.dev.yml # Database setup
└── package.json           # Root package management

API Endpoints

  • GET /api/health - Health check with uptime and timestamp

Database Schema

The application includes example users and posts tables. You can modify the schema in backend/src/db/schema.ts and run bun run db:push to apply changes.

Environment Variables

Copy .env.example.dev to .env for local development (or .env.example.prod for Docker production β€” see docker-compose.yml):

cp .env.example.dev .env

Key variables:

  • DATABASE_URL - PostgreSQL connection string
  • PORT - Server port (default: 3000)
  • HOST - Server host (default: 0.0.0.0)

Development Workflow

  1. Make changes to the frontend in frontend/src/
  2. Make changes to the backend in backend/src/
  3. Database changes go in backend/src/db/schema.ts
  4. Run bun run db:push after schema changes
  5. Both servers auto-reload during development

Production Deployment

The custom server in server.js combines both SvelteKit and ElysiaJS, making it easy to deploy as a single container. Build the project and run the server:

bun run build
bun run start

About

🌐 My personal portfolio website w/ admin CMS dashboard

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors