A SvelteKit application for document management with file upload, preview, and storage capabilities using PostgreSQL and MinIO.
The application is available at: https://sveltekit-challenge.onrender.com
Clone the repository
git clone <repository-url>
cd pack-challenge
Create environment file
cp .env.example .env
Or create a .env
file with the following variables:
DATABASE_URL="postgresql://postgres:prisma@db:5432/pack_db"
MINIO_ENDPOINT=minio
MINIO_PORT=9000
MINIO_ACCESS_KEY=minioadmin
MINIO_SECRET_KEY=minioadmin
MINIO_BUCKET=pack-challenge-bucket
MINIO_ROOT_USER=minioadmin
MINIO_ROOT_PASSWORD=minioadmin
USE_LOCAL_STORAGE=false
POSTGRES_USER=postgres
POSTGRES_PASSWORD=prisma
POSTGRES_DB=pack_db
Start the application
docker-compose up -d
Access the application
Install dependencies
npm install
Start PostgreSQL and MinIO
docker-compose up db minio -d
Set up database
npx prisma migrate deploy
npx prisma generate
Start development server
npm run dev
The application uses a PostgreSQL database with the following main model:
npm run dev
- Start development servernpm run build
- Build for productionnpm run preview
- Preview production buildnpm run check
- Type check with Sveltenpm run format
- Format code with Prettiernpm run lint
- Check code formattingsrc/
āāā lib/
ā āāā components/ # Svelte components
ā āāā config.ts # Application configuration
ā āāā prisma.ts # Prisma client
ā āāā storage.ts # Storage utilities
ā āāā validation.ts # Input validation
āāā routes/
ā āāā +page.svelte # Home page
ā āāā api/ # API endpoints
āāā app.html # HTML template
Variable | Description | Default |
---|---|---|
DATABASE_URL |
PostgreSQL connection string | Required |
MINIO_ENDPOINT |
MinIO server endpoint | minio:9000 |
MINIO_ROOT_USER |
MinIO access key | minioadmin |
MINIO_ROOT_PASSWORD |
MinIO secret key | minioadmin |
MINIO_BUCKET_NAME |
Default bucket name | pack-challenge-bucket |
docker-compose logs db
.env
filedocker-compose logs minio
.env
filerm -rf node_modules package-lock.json && npm install
npx prisma generate
docker-compose ps