|
|
1 månad sedan | |
|---|---|---|
| .vscode | 1 månad sedan | |
| messages | 1 månad sedan | |
| project.inlang | 1 månad sedan | |
| src | 1 månad sedan | |
| static | 1 månad sedan | |
| .dockerignore | 1 månad sedan | |
| .gitignore | 1 månad sedan | |
| .npmrc | 1 månad sedan | |
| AGENTS.md | 1 månad sedan | |
| Dockerfile | 1 månad sedan | |
| LICENSE.md | 1 månad sedan | |
| README.md | 1 månad sedan | |
| config.json.example | 1 månad sedan | |
| jsconfig.json | 1 månad sedan | |
| package.json | 1 månad sedan | |
| pnpm-lock.yaml | 1 månad sedan | |
| pnpm-workspace.yaml | 1 månad sedan | |
| vite.config.js | 1 månad sedan |
A modern SvelteKit application with Svelte 5 runes, Tailwind CSS, and Flowbite components.
Install dependencies:
pnpm install
Copy the example configuration to create your local config.json:
cp config.json.example config.json
This file contains settings for database and server configuration. See Configuration below for available options.
Start the dev server on http://localhost:3000:
npm run dev
# Auto-open in browser
npm run dev -- --open
Hot module reload enabled by default.
Create a production build:
npm run build
Preview the production build locally:
npm run preview
Production output goes to /build/ (configured for Node.js via @sveltejs/adapter-node).
The application includes a multi-stage Dockerfile for production deployments using Node.js 24 Alpine.
Build the Docker image:
docker build -t testing-proxy .
Run the container with a mounted configuration file:
docker run -d \
--name testing-proxy \
-p 3000:3000 \
--volume ./config.json:/opt/app/server/config.json:ro \
--volume ./data:/opt/app/data \
testing-proxy
The flags:
--volume ./config.json:/opt/app/server/config.json:ro — Mounts your local config.json as read-only inside the container--volume ./data:/opt/app/data — Persists the SQLite database across container restartsEnsure config.json exists before running:
cp config.json.example config.json
mkdir -p data
Use Docker Compose for orchestrated deployments with secrets management:
version: '3.8'
services:
app:
image: testing-proxy:latest
container_name: testing-proxy
ports:
- "3000:3000"
secrets:
- source: config_secret
target: /opt/app/server/config.json
uid: "1000"
gid: "1000"
mode: 0400
volumes:
- ./data:/opt/app/data # Persist SQLite database
restart: unless-stopped
secrets:
config_secret:
file: ./config.json
Save as docker-compose.yml and run:
docker-compose up -d
The secrets section:
source — Named secret reference (config_secret)target — Container path where the config is mounted (/opt/app/server/config.json)uid / gid — User/group IDs inside the container (1000 for app user)mode — File permissions (0400 = read-only for owner)Before running Docker containers, create your configuration file:
cp config.json.example config.json
Both docker run and docker-compose methods expect config.json to exist on your host machine and mount it into the container.
For Docker Compose deployments, the ./data volume persists the SQLite database across container restarts. Ensure the data/ directory is writable:
mkdir -p data
chmod 755 data
src/routes/ — SvelteKit filesystem routessrc/lib/ — Reusable components and utilities (access via $lib alias)src/app.html — HTML shell (dark mode enabled via class="dark")@tailwindcss/vite + Forms/Typography plugins@sveltejs/adapter-node)All .svelte files use runes mode by default. Use:
$state() for reactive variables$derived for computed values$effect() for side effects{#snippet} for component snippets (e.g., icon slots)See Svelte 5 runes documentation.
app.html (remove class="dark" from <html> to disable)<style> blocks in .svelte filesThe project uses Paraglide JS for i18n with:
/en/ or /es/)getLocale(), setLocale(), and deLocalizeUrl() from $lib/paraglide/runtime.js$lib/paraglide/messages.jsAll routes are automatically localized. No manual language handling needed.
The config.json file (copied from config.json.example) controls server and database settings:
{
"database": {
"type": "sqlite3",
"sqlite3": {
"fileMustExist": false,
"filename": "app.db",
"readonly": false,
"timeout": 5000,
"performance": {
"foreignKeys": true,
"journalMode": "wal",
"synchronous": 1,
"tempStore": "memory"
}
}
},
"password": {
"algorithm": "argon2id",
"options": {
"memoryCost": 61440,
"timeCost": 3,
"parallelism": 1
}
}
}
database.type — Database backend (currently sqlite3)database.sqlite3.filename — Path to the SQLite database filedatabase.sqlite3.timeout — Query timeout in millisecondsdatabase.sqlite3.performance — Performance tuning options (WAL mode, foreign keys, etc.)password.algorithm — Password hashing algorithm (currently argon2id)password.options — Argon2id configuration (memory cost in KiB, time cost iterations, parallelism level)The database is automatically initialized on first creation with:
users table — Stores user accounts with email and password (hashed) fieldsadmin@delete.me and password deleteme (hashed with argon2id)Database initialization is idempotent and runs only once when the database file is first created. The admin user is seeded only if no users exist.
Passwords are hashed using Argon2id (configured in config.json). Crypto utilities are available in src/lib/crypto.js for hashing and verification.
The application uses the following exit codes for process termination:
| Code | Meaning | Trigger |
|---|---|---|
0 |
Success / Graceful shutdown | SIGTERM, SIGINT signals |
1 |
Runtime error | Uncaught exceptions or unhandled promise rejections |
2 |
Cleanup error | Error during graceful shutdown cleanup logic |
Exit codes are defined in src/hooks.server.js and are emitted when the process receives termination signals or encounters runtime errors.