A modern SvelteKit 5 demo application with Node.js adapter and server-side rendering enabled.
- SvelteKit 5 - Modern, fast web framework
- Node.js Adapter - Production-ready deployment
- Server-Side Rendering (SSR) - Better SEO and initial load performance
- Vite - Lightning-fast build tool
- Svelte 5 Runes - Reactive state management
- Demo Pages - Home, About, and Blog Post examples
- API Routes - Sample REST endpoint
- Modern Styling - Clean, responsive design
src/
├── routes/
│ ├── +layout.svelte # Root layout with navigation
│ ├── +page.svelte # Home page
│ ├── about/
│ │ └── +page.svelte # About page
│ ├── posts/
│ │ ├── +page.js # Posts page loader
│ │ └── +page.svelte # Posts page component
│ └── api/
│ └── hello/
│ └── +server.js # Sample API endpoint
├── app.css # Global styles
└── app.html # HTML shell
svelte.config.js # SvelteKit configuration with Node adapter
vite.config.js # Vite build configuration
tsconfig.json # TypeScript configuration
- Node.js 18+
- npm
- PostgreSQL 15+ (for database functionality)
- Install dependencies:
npm install- Set up PostgreSQL database:
# Create the database
createdb ai_assessment
# Or using psql
psql -U postgres -c "CREATE DATABASE ai_assessment;"- Configure environment variables:
# Copy the example environment file
cp .env.example .env
# Edit .env with your database credentials
# Update DB_PASSWORD with your PostgreSQL password- Push the database schema:
npm run db:pushStart the development server:
npm run devThe app will be available at http://localhost:5173
npm run db:generate # Generate migration from schema changes
npm run db:push # Push schema to database (development)
npm run db:studio # Open Drizzle Studio (database GUI)Verify your database connection:
curl http://localhost:5173/api/healthOr visit http://localhost:5173/api/health in your browser.
Build for production:
npm run buildThis generates a standalone build directory with everything needed to run the app.
Run the built app:
npm startThe app will serve on http://localhost:3000 by default.
- / - Home page with interactive counter
- /about - About page with information about SvelteKit
- /posts - Blog posts page with sample data
- /api/hello - API endpoint (try
/api/hello?name=YourName)
The app uses the @sveltejs/adapter-node with:
- Output directory:
build - Precompression: Enabled (gzip compression for assets)
- Environment prefix:
APP_(for public variables)
- SSR Enabled - All pages rendered on the server
- Node.js Runtime - Standard Node.js environment
- File-based routing - Routes automatically created from file structure
When running npm run build, the output is a Node.js application that:
- Serves both static assets and dynamic pages
- Handles server-side rendering
- Can be deployed to any Node.js hosting platform
The build includes:
build/- Production build directorybuild/client/- Precompressed static assetsbuild/server/- Server bundlesbuild/index.js- Entry point
The Node adapter supports deployment to:
- Traditional servers (VPS, dedicated hosts)
- Platform services (Heroku, Railway, etc.)
- Container platforms (Docker, Kubernetes)
- Node.js-compatible serverless (Google Cloud Run, Azure Container Instances, etc.)
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY build ./build
EXPOSE 3000
CMD ["node", "build"]MIT
Created with ❤️ using SvelteKit 5