docker.recipes

SolidStart + PostgreSQL

intermediate

SolidJS meta-framework with server-side rendering.

Overview

SolidStart is a meta-framework built on top of SolidJS that provides server-side rendering, file-based routing, and full-stack capabilities for building modern web applications. Created by Ryan Carniato and the SolidJS team, SolidStart combines the fine-grained reactivity of SolidJS with powerful server-side features, eliminating the Virtual DOM overhead while delivering exceptional performance through compile-time optimizations and minimal runtime overhead. This stack pairs SolidStart with PostgreSQL to create a robust full-stack development environment where SolidStart handles the frontend reactivity and SSR capabilities while PostgreSQL manages complex relational data with ACID compliance. The combination leverages SolidStart's server functions and API routes to interact with PostgreSQL's advanced querying capabilities, JSON support, and transaction management, making it ideal for applications that need both reactive user interfaces and reliable data persistence. Developers building data-intensive applications, enterprise dashboards, or modern web applications requiring both client-side interactivity and server-side rendering will find this stack particularly valuable. The pairing is especially powerful for teams that need PostgreSQL's mature ecosystem and advanced features like full-text search, geospatial data handling with PostGIS, or complex analytical queries, while maintaining the developer experience and performance benefits of SolidStart's fine-grained reactivity system.

Key Features

  • Fine-grained reactivity system without Virtual DOM overhead for optimal performance
  • Server-side rendering with hydration using SolidStart's built-in SSR capabilities
  • File-based routing in src/routes/ directory with automatic route generation
  • Server functions using 'use server' directive for backend logic
  • PostgreSQL ACID compliance with advanced transaction support for data integrity
  • JSON/JSONB support in PostgreSQL for hybrid relational-document data models
  • Full-text search capabilities with PostgreSQL's built-in search and ranking
  • SolidStart's compile-time optimizations reducing bundle size and runtime cost

Common Use Cases

  • 1E-commerce platforms requiring real-time inventory management with complex product catalogs
  • 2Enterprise dashboards displaying analytical data with interactive charts and real-time updates
  • 3Content management systems with full-text search and structured content relationships
  • 4Financial applications needing ACID transactions and precise numerical calculations
  • 5Social platforms requiring user-generated content with relational data modeling
  • 6GIS applications using PostGIS extension for location-based services
  • 7Multi-tenant SaaS applications with complex user permissions and data isolation

Prerequisites

  • Docker and Docker Compose installed and running
  • Node.js knowledge for SolidStart development and server functions
  • SQL proficiency for PostgreSQL database design and querying
  • Minimum 1GB RAM available (512MB for PostgreSQL, 512MB for SolidStart)
  • Port 3000 available for SolidStart application access
  • Understanding of server-side rendering concepts and hydration patterns

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 solidstart:
3 build: .
4 container_name: solidstart
5 environment:
6 DATABASE_URL: postgresql://${DB_USER}:${DB_PASSWORD}@postgres:5432/${DB_NAME}
7 ports:
8 - "3000:3000"
9 depends_on:
10 - postgres
11 networks:
12 - solid-network
13
14 postgres:
15 image: postgres:16-alpine
16 environment:
17 POSTGRES_DB: ${DB_NAME}
18 POSTGRES_USER: ${DB_USER}
19 POSTGRES_PASSWORD: ${DB_PASSWORD}
20 volumes:
21 - postgres_data:/var/lib/postgresql/data
22 networks:
23 - solid-network
24
25volumes:
26 postgres_data:
27
28networks:
29 solid-network:
30 driver: bridge

.env Template

.env
1DB_NAME=solidstart
2DB_USER=solidstart
3DB_PASSWORD=changeme

Usage Notes

  1. 1Docs: https://start.solidjs.com/
  2. 2Access at http://localhost:3000
  3. 3Fine-grained reactivity without Virtual DOM
  4. 4File-based routing in src/routes/
  5. 5Server functions with use server
  6. 6Use Prisma or Drizzle for database access

Individual Services(2 services)

Copy individual services to mix and match with your existing compose files.

solidstart
solidstart:
  build: .
  container_name: solidstart
  environment:
    DATABASE_URL: postgresql://${DB_USER}:${DB_PASSWORD}@postgres:5432/${DB_NAME}
  ports:
    - "3000:3000"
  depends_on:
    - postgres
  networks:
    - solid-network
postgres
postgres:
  image: postgres:16-alpine
  environment:
    POSTGRES_DB: ${DB_NAME}
    POSTGRES_USER: ${DB_USER}
    POSTGRES_PASSWORD: ${DB_PASSWORD}
  volumes:
    - postgres_data:/var/lib/postgresql/data
  networks:
    - solid-network

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 solidstart:
5 build: .
6 container_name: solidstart
7 environment:
8 DATABASE_URL: postgresql://${DB_USER}:${DB_PASSWORD}@postgres:5432/${DB_NAME}
9 ports:
10 - "3000:3000"
11 depends_on:
12 - postgres
13 networks:
14 - solid-network
15
16 postgres:
17 image: postgres:16-alpine
18 environment:
19 POSTGRES_DB: ${DB_NAME}
20 POSTGRES_USER: ${DB_USER}
21 POSTGRES_PASSWORD: ${DB_PASSWORD}
22 volumes:
23 - postgres_data:/var/lib/postgresql/data
24 networks:
25 - solid-network
26
27volumes:
28 postgres_data:
29
30networks:
31 solid-network:
32 driver: bridge
33EOF
34
35# 2. Create the .env file
36cat > .env << 'EOF'
37DB_NAME=solidstart
38DB_USER=solidstart
39DB_PASSWORD=changeme
40EOF
41
42# 3. Start the services
43docker compose up -d
44
45# 4. View logs
46docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/solidstart-postgres/run | bash

Troubleshooting

  • Database connection refused: Ensure postgres service is fully started before solidstart container attempts connection using depends_on
  • SolidStart hydration mismatch: Verify server and client data consistency, especially with async database queries in server functions
  • PostgreSQL 'role does not exist': Check DB_USER environment variable matches POSTGRES_USER in docker-compose configuration
  • Port 3000 already in use: Stop other applications using port 3000 or modify the port mapping in the solidstart service
  • SolidStart build failures: Ensure Dockerfile has proper Node.js version and npm/pnpm dependencies are correctly installed
  • PostgreSQL data persistence issues: Verify postgres_data volume is properly mounted to /var/lib/postgresql/data

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

Ad Space