diff --git a/README.md b/README.md index c2e863d..cd612d3 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,14 @@ -# Next.js Application with PostgreSQL +# Next.js Application with Multi-Database Support -A production-ready Next.js 16 application with integrated PostgreSQL database, built with TypeScript, Tailwind CSS, and modern development tools. +A production-ready Next.js 16 application with database management capabilities, built with TypeScript, Tailwind CSS, and DrizzleORM for connecting to multiple database backends. ## Overview This project is a full-stack web application featuring: - **Next.js 16** with App Router for server-side rendering and static site generation -- **PostgreSQL 15** database with DrizzleORM for type-safe database operations +- **DrizzleORM** for type-safe database operations with support for PostgreSQL, MySQL, and SQLite +- **PostgreSQL 15** included as default database in Docker container +- **Multi-database support** - Connect to external PostgreSQL, MySQL, or SQLite servers - **Authentication** using Clerk with support for multiple auth providers - **TypeScript** for type safety across the entire stack - **Tailwind CSS 4** for modern, responsive styling @@ -19,8 +21,9 @@ This project is a full-stack web application featuring: - ๐Ÿ”ฅ **TypeScript** for type safety - ๐Ÿ’Ž **Tailwind CSS 4** for styling - ๐Ÿ”’ **Clerk Authentication** with social login support -- ๐Ÿ“ฆ **DrizzleORM** with PostgreSQL database -- ๐Ÿณ **Docker** support with all-in-one container +- ๐Ÿ“ฆ **DrizzleORM** - Support for PostgreSQL, MySQL, and SQLite +- ๐Ÿ”Œ **Multi-Database Support** - Connect to custom database servers +- ๐Ÿณ **Docker** with included PostgreSQL 15 (default option) - ๐Ÿงช **Testing Suite** - Vitest for unit tests, Playwright for E2E - ๐ŸŽจ **Storybook** for UI component development - ๐Ÿ“ **ESLint & Prettier** for code quality @@ -73,7 +76,9 @@ npm run dev ### Docker Deployment -Build and run the application with Docker: +The Docker container includes PostgreSQL 15 as the default database option. You can also connect to external database servers. + +Build and run with included PostgreSQL: ```bash docker build -t postgres-app . @@ -82,7 +87,16 @@ docker run -p 3000:3000 -p 5432:5432 \ postgres-app ``` -The Docker container includes both PostgreSQL and the Next.js application in a single image. +Or connect to an external database: + +```bash +docker run -p 3000:3000 \ + -e DATABASE_URL="******your-external-db:5432/mydb" \ + -e JWT_SECRET=your_secret_here \ + postgres-app +``` + +The Docker container includes both PostgreSQL and the Next.js application, but PostgreSQL is optional - you can connect to any external PostgreSQL, MySQL, or SQLite database. ## Project Structure @@ -135,12 +149,36 @@ The Docker container includes both PostgreSQL and the Next.js application in a s ## Database Schema +This application uses [DrizzleORM](https://orm.drizzle.team/) which supports multiple database backends: +- **PostgreSQL** (default, included in Docker container) +- **MySQL/MariaDB** (connect to external server) +- **SQLite** (for local development) + Database schemas are defined in `src/models/Schema.ts` using DrizzleORM. To modify the schema: 1. Edit `src/models/Schema.ts` 2. Generate migration: `npm run db:generate` 3. Apply migration: `npm run db:migrate` +### Connecting to Different Databases + +The included PostgreSQL in Docker is just the default option. You can connect to any database by setting the `DATABASE_URL` environment variable: + +**PostgreSQL:** +```env +DATABASE_URL=******localhost:5432/mydb +``` + +**MySQL:** +```env +DATABASE_URL=mysql://user:password@localhost:3306/mydb +``` + +**SQLite:** +```env +DATABASE_URL=file:./local.db +``` + ## Authentication This project uses [Clerk](https://clerk.com) for authentication. To set up: diff --git a/ROADMAP.md b/ROADMAP.md index afc38b0..0e6e0ca 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -6,10 +6,10 @@ This document outlines the planned features, improvements, and technical debt it โœ… **Completed** - Next.js 16 with App Router -- PostgreSQL 15 integration -- DrizzleORM for database operations +- PostgreSQL 15 integration (included as default in Docker) +- DrizzleORM for database operations (supports PostgreSQL, MySQL, SQLite) - Basic authentication system (Clerk integration available) -- Docker containerization +- Docker containerization with optional embedded PostgreSQL - Unit testing with Vitest - E2E testing with Playwright - Storybook for component development @@ -35,6 +35,28 @@ This document outlines the planned features, improvements, and technical debt it - Add table migration history viewer - Create database backup/restore UI +- [ ] **Multi-Database Server Support** ๐Ÿ”Œ + - **Connection Management** + - Add custom database servers to connection list + - Server dropdown selector in UI + - Save connection configurations securely + - Quick switch between database servers + - Connection status indicators (connected/disconnected) + - Test connection before saving + - **Multi-Database Backend Support** + - PostgreSQL support (current) + - MySQL/MariaDB support via Drizzle ORM + - SQLite support via Drizzle ORM + - Database type auto-detection + - Driver-specific features and optimizations + - **Connection Details** + - Host, port, database name configuration + - Username/password authentication + - SSL/TLS connection options + - Connection pooling settings + - Custom connection string support + - Import/export connection profiles + - [ ] **Simple Authentication UI** - Build clean login screen with username/password - Create user registration page @@ -89,6 +111,8 @@ This document outlines the planned features, improvements, and technical debt it - Implement security headers - Add dependency vulnerability scanning in CI - Regular security audits + - Encrypt stored database credentials + - Secure connection string storage with environment variables - [ ] **CI/CD Pipeline** - Add automated deployment workflows