Remix + Prisma + PostgreSQL
Full-stack Remix application with Prisma ORM and PostgreSQL database.
Overview
Remix is a full-stack web framework that focuses on web standards and modern UX, built by the creators of React Router. It emphasizes server-side rendering, progressive enhancement, and efficient data loading through its nested routing system and built-in data fetching capabilities. Unlike traditional React frameworks, Remix leverages the web platform's native capabilities for forms, caching, and navigation while providing excellent developer experience with TypeScript support and file-based routing.
This stack combines Remix's full-stack capabilities with Prisma's type-safe database toolkit and PostgreSQL's robust relational database features. Prisma generates TypeScript types from your database schema, providing end-to-end type safety from database queries to your Remix loaders and actions. Redis handles session storage and caching to improve performance, while PostgreSQL stores your application data with ACID compliance and advanced querying capabilities. NGINX serves as a reverse proxy, handling SSL termination and static file serving in production.
This combination is ideal for developers building data-intensive web applications who value type safety, performance, and maintainability. Startups and medium-sized companies will appreciate the rapid development cycle enabled by Prisma's schema-first approach and Remix's convention-over-configuration philosophy. The stack excels for applications requiring complex data relationships, user authentication, and real-time features while maintaining excellent SEO and user experience through server-side rendering.
Key Features
- Server-side rendering with Remix's nested routing and progressive enhancement
- Type-safe database operations with Prisma's auto-generated TypeScript client
- Redis-based session management with automatic expiration and distributed storage
- PostgreSQL's JSONB support for flexible schema alongside relational data
- Prisma's database migrations with automatic schema synchronization
- NGINX reverse proxy with HTTP/2 support and static asset optimization
- Remix's built-in error boundaries and catch boundaries for robust error handling
- PostgreSQL's full-text search capabilities integrated with Prisma queries
Common Use Cases
- 1E-commerce platforms with complex product catalogs and user management
- 2Content management systems requiring SEO optimization and fast page loads
- 3SaaS applications with multi-tenant data isolation and real-time features
- 4Educational platforms with user progress tracking and content delivery
- 5Dashboard applications with data visualization and user authentication
- 6Blog platforms with commenting systems and content management
- 7Booking systems with availability tracking and payment processing
Prerequisites
- Docker Engine 20.10+ and Docker Compose V2
- Node.js 18+ knowledge for Remix development and Prisma CLI usage
- Minimum 2GB RAM (1GB for PostgreSQL, 512MB for Redis, 512MB for applications)
- Basic understanding of SQL and database schema design
- Ports 80, 443, 3000, 5432, and 6379 available on host system
- Familiarity with TypeScript and React for Remix development
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 remix: 3 build: 4 context: .5 dockerfile: Dockerfile6 ports: 7 - "3000:3000"8 environment: 9 DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}10 REDIS_URL: redis://redis:637911 SESSION_SECRET: ${SESSION_SECRET}12 depends_on: 13 postgres: 14 condition: service_healthy15 redis: 16 condition: service_started17 networks: 18 - remix-net19 restart: unless-stopped2021 postgres: 22 image: postgres:16-alpine23 environment: 24 POSTGRES_USER: ${POSTGRES_USER}25 POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}26 POSTGRES_DB: ${POSTGRES_DB}27 volumes: 28 - postgres_data:/var/lib/postgresql/data29 healthcheck: 30 test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]31 interval: 10s32 timeout: 5s33 retries: 534 networks: 35 - remix-net36 restart: unless-stopped3738 redis: 39 image: redis:7-alpine40 volumes: 41 - redis_data:/data42 networks: 43 - remix-net44 restart: unless-stopped4546 nginx: 47 image: nginx:alpine48 ports: 49 - "80:80"50 - "443:443"51 volumes: 52 - ./nginx.conf:/etc/nginx/nginx.conf:ro53 - ./certs:/etc/nginx/certs:ro54 depends_on: 55 - remix56 networks: 57 - remix-net58 restart: unless-stopped5960volumes: 61 postgres_data: 62 redis_data: 6364networks: 65 remix-net: 66 driver: bridge.env Template
.env
1# PostgreSQL2POSTGRES_USER=remix3POSTGRES_PASSWORD=secure_postgres_password4POSTGRES_DB=remix56# Remix7SESSION_SECRET=secure_session_secret_at_least_32_chars8NODE_ENV=productionUsage Notes
- 1Create Remix app: npx create-remix
- 2Remix app at http://localhost:3000
- 3Run migrations: npx prisma migrate deploy
- 4Configure nginx.conf for production
Individual Services(4 services)
Copy individual services to mix and match with your existing compose files.
remix
remix:
build:
context: .
dockerfile: Dockerfile
ports:
- "3000:3000"
environment:
DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
REDIS_URL: redis://redis:6379
SESSION_SECRET: ${SESSION_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_started
networks:
- remix-net
restart: unless-stopped
postgres
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test:
- CMD-SHELL
- pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}
interval: 10s
timeout: 5s
retries: 5
networks:
- remix-net
restart: unless-stopped
redis
redis:
image: redis:7-alpine
volumes:
- redis_data:/data
networks:
- remix-net
restart: unless-stopped
nginx
nginx:
image: nginx:alpine
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./certs:/etc/nginx/certs:ro
depends_on:
- remix
networks:
- remix-net
restart: unless-stopped
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 remix:5 build:6 context: .7 dockerfile: Dockerfile8 ports:9 - "3000:3000"10 environment:11 DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}12 REDIS_URL: redis://redis:637913 SESSION_SECRET: ${SESSION_SECRET}14 depends_on:15 postgres:16 condition: service_healthy17 redis:18 condition: service_started19 networks:20 - remix-net21 restart: unless-stopped2223 postgres:24 image: postgres:16-alpine25 environment:26 POSTGRES_USER: ${POSTGRES_USER}27 POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}28 POSTGRES_DB: ${POSTGRES_DB}29 volumes:30 - postgres_data:/var/lib/postgresql/data31 healthcheck:32 test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]33 interval: 10s34 timeout: 5s35 retries: 536 networks:37 - remix-net38 restart: unless-stopped3940 redis:41 image: redis:7-alpine42 volumes:43 - redis_data:/data44 networks:45 - remix-net46 restart: unless-stopped4748 nginx:49 image: nginx:alpine50 ports:51 - "80:80"52 - "443:443"53 volumes:54 - ./nginx.conf:/etc/nginx/nginx.conf:ro55 - ./certs:/etc/nginx/certs:ro56 depends_on:57 - remix58 networks:59 - remix-net60 restart: unless-stopped6162volumes:63 postgres_data:64 redis_data:6566networks:67 remix-net:68 driver: bridge69EOF7071# 2. Create the .env file72cat > .env << 'EOF'73# PostgreSQL74POSTGRES_USER=remix75POSTGRES_PASSWORD=secure_postgres_password76POSTGRES_DB=remix7778# Remix79SESSION_SECRET=secure_session_secret_at_least_32_chars80NODE_ENV=production81EOF8283# 3. Start the services84docker compose up -d8586# 4. View logs87docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/remix-prisma-stack/run | bashTroubleshooting
- Prisma Client not found: Run 'npx prisma generate' to regenerate the client after schema changes
- Database connection refused: Ensure PostgreSQL is healthy with 'docker-compose ps' and check DATABASE_URL format
- Redis connection timeout: Verify Redis container is running and REDIS_URL matches service name 'redis:6379'
- Remix build failures: Clear node_modules and run 'npm install' then 'npm run build' to resolve dependency conflicts
- NGINX 502 Bad Gateway: Check that Remix service is running on port 3000 and nginx.conf upstream configuration is correct
- Prisma migration failures: Reset database with 'npx prisma migrate reset' and reapply migrations in development
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
remixpostgresqlredisnginx
Tags
#remix#prisma#postgresql#typescript#react
Category
Full Web StacksAd Space
Shortcuts: C CopyF FavoriteD Download