2025-09-09 18:02:21 +00:00
2025-09-09 08:52:28 +02:00
2025-09-08 13:55:29 +02:00
2025-09-09 08:52:28 +02:00
2025-09-09 17:50:13 +00:00
2025-09-09 08:52:28 +02:00
2025-09-08 13:55:29 +02:00
2025-09-09 08:52:28 +02:00
2025-09-09 08:52:28 +02:00
2025-09-09 17:52:08 +00:00
2025-09-09 18:02:21 +00:00
2025-09-09 08:52:28 +02:00
2025-09-09 08:52:28 +02:00
2025-09-08 13:55:29 +02:00
2025-09-09 08:52:28 +02:00
2025-09-09 08:52:28 +02:00
2025-09-09 08:52:28 +02:00
2025-09-09 08:52:28 +02:00
2025-09-08 13:55:29 +02:00

Nuxt 4 met Database

Een moderne Nuxt 4 applicatie met PostgreSQL database, draaiend via Docker Compose.

Features

  • 🚀 Nuxt 4 met TypeScript
  • 🐘 PostgreSQL database
  • 🐳 Docker & Docker Compose
  • 🎨 Tailwind CSS voor styling
  • 📊 Sequelize ORM voor database management
  • 🔄 API routes voor CRUD operaties

Quick Start

1. Clone en setup

git clone <repository-url>
cd nuxt-deploy

2. Start met Docker Compose

docker-compose up --build

3. Database migratie (eerste keer)

# In een nieuwe terminal
docker-compose exec nuxt-app npm run db:migrate

4. Open de applicatie

Ga naar http://localhost:3000

Development

Lokale development (zonder Docker)

# Installeer dependencies
npm install

# Start PostgreSQL (via Docker)
docker-compose up postgres -d

# Setup database
npm run db:migrate

# Start development server
npm run dev

Database management

# Run migrations
npm run db:migrate

# Create database
npm run db:create

# Seed database
npm run db:seed

API Endpoints

Users

  • GET /api/users - Alle gebruikers ophalen
  • POST /api/users - Nieuwe gebruiker aanmaken

Posts

  • GET /api/posts - Alle posts ophalen
  • POST /api/posts - Nieuwe post aanmaken

Database Schema

User

  • id (Int, Primary Key)
  • email (String, Unique)
  • name (String, Optional)
  • createdAt (DateTime)
  • updatedAt (DateTime)

Post

  • id (Int, Primary Key)
  • title (String)
  • content (String, Optional)
  • published (Boolean, Default: false)
  • authorId (Int, Foreign Key)
  • createdAt (DateTime)
  • updatedAt (DateTime)

Docker Services

  • nuxt-app: Nuxt 4 applicatie (poort 3000)
  • postgres: PostgreSQL database (poort 5432)

Environment Variables

Kopieer env.example naar .env en pas aan indien nodig:

cp env.example .env

Troubleshooting

Database connection issues

# Check of PostgreSQL draait
docker-compose ps

# Check logs
docker-compose logs postgres

Sequelize issues

# Run migrations
docker-compose exec nuxt-app npm run db:migrate

# Reset en herstart database
docker-compose down -v
docker-compose up --build

Production Deployment

Voor productie deployment:

  1. Update docker-compose.yml met productie instellingen
  2. Gebruik environment variables voor secrets
  3. Setup reverse proxy (nginx)
  4. Configure SSL certificaten
  5. Setup database backups

Tech Stack

  • Frontend: Nuxt 4, Vue 3, TypeScript
  • Backend: Nuxt Server API
  • Database: PostgreSQL 15
  • ORM: Sequelize
  • Styling: Tailwind CSS
  • Containerization: Docker & Docker Compose
Description
No description provided
Readme 95 KiB
Languages
Vue 41%
JavaScript 31%
TypeScript 23.2%
Shell 3.3%
Dockerfile 1.5%