A Secret Santa application built with SolidJS frontend and Express.js backend.
Create profiles, groups and draw a random gift recipient.
- Client: SolidJS app built with Vite and styled with TailwindCSS
- Server: Express.js API with SQLite database that also serves the client in production
- Node.js (version 18 or higher)
- npm or pnpm
-
Navigate to the client directory:
cd client -
Install dependencies:
npm install
-
Start development server:
npm run dev
-
Navigate to the server directory:
cd server -
Install dependencies:
npm install
-
Start development server:
npm run dev
Note: In development, the server provides a proxy to the client development server by default. This allows you to access both the client and API through the server URL (http://localhost:3100). The server automatically forwards non-API requests to the client development server running on port 3200.
-
Navigate to the client directory:
cd client -
Install production dependencies:
npm ci --production=false
-
Build for production:
npm run build:prod
-
Navigate to the server directory:
cd server -
Install production dependencies:
npm ci --production
-
Update the following environment files in the
serverdirectory:PORT=<SERVER PORT HERE> JWT_SECRET=<JWT SECRET HERE>
-
Build and start production server:
npm run prod
Note: In production, the server hosts both the API and the client application. The client will be available at https://localhost:<PORT>/ (where <PORT> is your configured server port), and the API endpoints will be available at https://localhost:<PORT>/api/*.
Ensure the following environment files exist in the client directory:
VITE_APP_API_URL=/VITE_APP_API_URL=/Required Client Environment Variables:
VITE_APP_API_URL: The base URL of the server. In production, the server hosts both the client and API. In development, the server provides a proxy to the client and hosts the API therefore the value/
Ensure the following environment files exist in the server directory:
PORT=<SERVER PORT HERE>
JWT_SECRET=<JWT SECRET HERE>
USE_HTTPS=true
HTTPS_CERT_PATH=./certs/cert.pem
HTTPS_KEY_PATH=./certs/key.pem
SQLITE_DB_FILE_PATH=./database/database.sqlite
SPA_STATIC_FILES_ROOT_PATH=../../client/build
USE_PROXY_TO_SPA_DEVELOPMENT_SERVER=false
PROXY_TO_SPA_DEVELOPMENT_SERVER_URL=PORT=3100
JWT_SECRET=f0e5ad01-2ef8-4304-8abb-14c51c9cbe56
USE_HTTPS=false
HTTPS_CERT_PATH=
HTTPS_KEY_PATH=
SQLITE_DB_FILE_PATH=./database/database.Development.sqlite
SPA_STATIC_FILES_ROOT_PATH=../../client/build
USE_PROXY_TO_SPA_DEVELOPMENT_SERVER=true
PROXY_TO_SPA_DEVELOPMENT_SERVER_URL=http://localhost:3200Required Server Environment Variables:
PORT: Port number for the server to listen onJWT_SECRET: Secret key for JWT token signing (use a secure random string in production)USE_HTTPS: Set totrueto enable HTTPS,falseto use HTTPHTTPS_CERT_PATH: Path to the SSL certificate file (required whenUSE_HTTPSistrue)HTTPS_KEY_PATH: Path to the SSL private key file (required whenUSE_HTTPSistrue)SQLITE_DB_FILE_PATH: Path to the SQLite database fileSPA_STATIC_FILES_ROOT_PATH: Path to the built client files (the server serves the client from this directory in production)USE_PROXY_TO_SPA_DEVELOPMENT_SERVER: Set totruefor development,falsefor productionPROXY_TO_SPA_DEVELOPMENT_SERVER_URL: URL of the development client server (required whenUSE_PROXY_TO_SPA_DEVELOPMENT_SERVERistrue)
- The SQLite database files will be created automatically when the server starts
- By default the database files will be created in the
server/databasefolder:- Production:
database.sqlite - Development:
database.Development.sqlite
- Production:
- Ensure the specified database directory exists and has write permissions
For production deployments with HTTPS support, you'll need to generate SSL certificates. Follow these steps from the server/certs directory:
-
Create a private key:
openssl genrsa -out key.pem
-
Generate a CSR (Certificate Signing Request):
openssl req -new -key key.pem -out csr.pem
-
Generate a certificate:
openssl x509 -req -days 9999 -in csr.pem -signkey key.pem -out cert.pem
Update your Server Environment Variables with the following HTTPS settings:
USE_HTTPS=true
HTTPS_CERT_PATH=./certs/cert.pem
HTTPS_KEY_PATH=./certs/key.pemNote: The generated certificate is self-signed and suitable for development or internal use. For production deployments, consider using certificates from a trusted Certificate Authority.
The application uses a configurable departments list that appears in department selection dropdowns throughout the application.
File Location: client/public/departments.json
Default Configuration:
{
"departments": ["Department A", "Department B", "Department C"]
}You can configure which users are allowed to manage (view, create, edit, delete) draw groups by editing the drawGroupManagers.json file.
File Location: server/drawGroupManagers.json
Default Configuration:
{
"drawGroupManagers": ["admin@secretsanta.com"]
}Note: Changes take effect immediately without requiring a rebuild, but users must re-login for changes to apply.
- User authentication with JWT tokens
- Secret Santa assignment management
- Responsive design with TailwindCSS
- SQLite database for data persistence