150 lines
2.7 KiB
Markdown
150 lines
2.7 KiB
Markdown
# Quick Setup Guide
|
|
|
|
Follow these steps to get your wishlist app running:
|
|
|
|
## Choose Your Setup Method
|
|
|
|
### Method 1: Docker Compose (Easiest) 🐳
|
|
|
|
If you have Docker installed, this is the fastest way to get started:
|
|
|
|
```bash
|
|
# Start everything with Docker
|
|
docker-compose up -d
|
|
|
|
# Run database migrations
|
|
docker-compose exec app bun run db:push
|
|
|
|
# View logs
|
|
docker-compose logs -f app
|
|
```
|
|
|
|
Visit `http://localhost:3000` 🎉
|
|
|
|
To stop:
|
|
```bash
|
|
docker-compose down
|
|
```
|
|
|
|
---
|
|
|
|
### Method 2: Local Development (Traditional)
|
|
|
|
## 1. Prerequisites
|
|
|
|
Make sure you have:
|
|
- ✅ Bun installed (already done!)
|
|
- ✅ PostgreSQL database running
|
|
|
|
### Setting up PostgreSQL (if needed)
|
|
|
|
#### Option A: Local PostgreSQL
|
|
```bash
|
|
# Install PostgreSQL (Ubuntu/Debian)
|
|
sudo apt install postgresql postgresql-contrib
|
|
|
|
# Start PostgreSQL
|
|
sudo systemctl start postgresql
|
|
|
|
# Create a database
|
|
sudo -u postgres createdb wishlist
|
|
|
|
# Create a user and grant permissions
|
|
sudo -u postgres psql
|
|
CREATE USER wishlistuser WITH PASSWORD 'yourpassword';
|
|
GRANT ALL PRIVILEGES ON DATABASE wishlist TO wishlistuser;
|
|
\q
|
|
```
|
|
|
|
#### Option B: Docker PostgreSQL
|
|
```bash
|
|
docker run --name wishlist-postgres \
|
|
-e POSTGRES_DB=wishlist \
|
|
-e POSTGRES_USER=wishlistuser \
|
|
-e POSTGRES_PASSWORD=yourpassword \
|
|
-p 5432:5432 \
|
|
-d postgres:16
|
|
```
|
|
|
|
#### Option C: Hosted Database
|
|
- [Supabase](https://supabase.com/) - Free tier available
|
|
- [Neon](https://neon.tech/) - Serverless PostgreSQL
|
|
- [Railway](https://railway.app/) - Easy deployment
|
|
|
|
## 2. Configure Environment
|
|
|
|
Create `.env` file:
|
|
```bash
|
|
cp .env.example .env
|
|
```
|
|
|
|
Edit `.env` with your database connection:
|
|
```env
|
|
DATABASE_URL=postgresql://wishlistuser:yourpassword@localhost:5432/wishlist
|
|
```
|
|
|
|
## 3. Setup Database
|
|
|
|
```bash
|
|
# Push the schema to your database
|
|
bun run db:push
|
|
```
|
|
|
|
## 4. Start Development Server
|
|
|
|
```bash
|
|
bun run dev
|
|
```
|
|
|
|
Visit `http://localhost:5173` 🎉
|
|
|
|
## Troubleshooting
|
|
|
|
### Database Connection Issues
|
|
|
|
If you get connection errors:
|
|
|
|
1. Check PostgreSQL is running:
|
|
```bash
|
|
# Linux/Mac
|
|
sudo systemctl status postgresql
|
|
|
|
# Docker
|
|
docker ps | grep postgres
|
|
```
|
|
|
|
2. Verify connection string format:
|
|
```
|
|
postgresql://username:password@host:port/database
|
|
```
|
|
|
|
3. Test connection:
|
|
```bash
|
|
psql "postgresql://wishlistuser:yourpassword@localhost:5432/wishlist"
|
|
```
|
|
|
|
### Port Already in Use
|
|
|
|
If port 5173 is taken:
|
|
```bash
|
|
bun run dev -- --port 3000
|
|
```
|
|
|
|
### Schema Changes
|
|
|
|
After modifying `src/lib/server/schema.ts`:
|
|
```bash
|
|
bun run db:push
|
|
```
|
|
|
|
## Next Steps
|
|
|
|
1. Create your first wishlist
|
|
2. Add some items
|
|
3. Share the public link with friends
|
|
4. Save your owner link somewhere safe!
|
|
|
|
## Production Deployment
|
|
|
|
See the main README.md for deployment instructions.
|