A modern web application for managing and sharing resources, built with SvelteKit, Prisma, and PostgreSQL.
Clone the repository:
git clone <repository-url>
cd <repository-name>
Copy the environment file:
cp .env.example .env
IMPORTANT: Ensure your .env
file contains all required variables:
```
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/pack_db"
UPLOAD_DIR="static/uploads" MAX_FILE_SIZE="100000000" # 100MB in bytes
4. Start the Docker containers:
```bash
docker-compose up -d
Install dependencies:
pnpm install
# or
npm install
Run database migrations:
pnpm prisma migrate dev
# or
npx prisma migrate dev
Start the development server:
pnpm dev
# or
npm run dev
The application will be available at http://localhost:5173
Clone the repository:
git clone <repository-url>
cd <repository-name>
Copy the environment file:
cp .env.example .env
IMPORTANT: Update the environment variables in .env
:
```
DATABASE_URL="postgresql://username:password@localhost:5432/pack_db"
UPLOAD_DIR="static/uploads" MAX_FILE_SIZE="100000000" # 100MB in bytes
4. Create the upload directory:
```bash
mkdir -p static/uploads
Install dependencies:
pnpm install
# or
npm install
Set up the database: ```bash
createdb pack_db
pnpm prisma migrate dev
npx prisma migrate dev
7. Start the development server:
```bash
pnpm dev
# or
npm run dev
The application will be available at http://localhost:5173
If you encounter errors related to file uploads, check that your .env
file includes:
UPLOAD_DIR="static/uploads"
Port conflicts: If you see errors about ports being in use:
# Check what's using the ports
lsof -i :5432
lsof -i :5173
# Stop the conflicting services or change ports in docker-compose.yml
Container not starting:
# Check container logs
docker-compose logs
# Restart containers
docker-compose down
docker-compose up -d
Database connection issues:
docker-compose ps
.env
matches Docker setupnpx prisma migrate reset
Permission errors:
# Ensure upload directory exists and has proper permissions
mkdir -p static/uploads
chmod 755 static/uploads
File size limits:
MAX_FILE_SIZE
in .env
is set appropriatelymy-svelte-app/
├── src/
│ ├── lib/ # Shared components and utilities
│ ├── routes/ # SvelteKit routes and API endpoints
│ └── app.css # Global styles
├── static/ # Static assets
│ └── uploads/ # Uploaded files directory
├── prisma/ # Database schema and migrations
├── .env.example # Example environment variables
├── .env # Environment variables
├── docker-compose.yml # Docker configuration
├── package.json # Project metadata and dependencies
└── README.md # Project documentation
All API endpoints are located in src/routes/api/
following SvelteKit's routing conventions:
/api/resources
- List all resources/api/resources
- Create a new resource/api/resources/[id]
- Get a specific resource/api/resources/[id]/view
- Increment view count# Run tests
pnpm test
# or
npm run test
Before submitting for review, ensure:
.env
# Build the application
pnpm build
# or
npm run build
# Preview the production build
pnpm preview
# or
npm run preview