Add local dev setup guide and .env, fix defaults for local development
This commit is contained in:
105
LOCAL_SETUP.md
Normal file
105
LOCAL_SETUP.md
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
# Vynl - Local Development Setup
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- Docker and Docker Compose installed
|
||||||
|
- Spotify Developer account (for playlist import)
|
||||||
|
- Anthropic API key (for recommendations)
|
||||||
|
|
||||||
|
## 1. Configure Environment
|
||||||
|
|
||||||
|
Edit `backend/.env` and fill in your API keys:
|
||||||
|
|
||||||
|
```
|
||||||
|
SPOTIFY_CLIENT_ID=your-client-id
|
||||||
|
SPOTIFY_CLIENT_SECRET=your-client-secret
|
||||||
|
ANTHROPIC_API_KEY=your-api-key
|
||||||
|
```
|
||||||
|
|
||||||
|
Stripe keys are optional for local dev — billing will just not work without them.
|
||||||
|
|
||||||
|
## 2. Start Everything
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose up --build
|
||||||
|
```
|
||||||
|
|
||||||
|
This starts:
|
||||||
|
- **PostgreSQL** on port 5432
|
||||||
|
- **Redis** on port 6379
|
||||||
|
- **Backend API** on http://localhost:8000
|
||||||
|
- **Frontend** on http://localhost:5173
|
||||||
|
|
||||||
|
The backend runs Alembic migrations automatically on startup.
|
||||||
|
|
||||||
|
## 3. Open the App
|
||||||
|
|
||||||
|
Go to http://localhost:5173
|
||||||
|
|
||||||
|
- Register with email/password
|
||||||
|
- Or connect Spotify (must configure Spotify Developer App first)
|
||||||
|
|
||||||
|
## 4. Spotify Developer App Setup
|
||||||
|
|
||||||
|
1. Go to https://developer.spotify.com/dashboard
|
||||||
|
2. Create an app
|
||||||
|
3. Set redirect URI to: `http://localhost:5173/auth/spotify/callback`
|
||||||
|
4. Copy Client ID and Client Secret to `backend/.env`
|
||||||
|
|
||||||
|
Note: Spotify apps start in Development Mode (25 user limit). This is fine for testing.
|
||||||
|
|
||||||
|
## 5. Test the Flow
|
||||||
|
|
||||||
|
1. Register an account
|
||||||
|
2. Connect Spotify
|
||||||
|
3. Import a playlist
|
||||||
|
4. Go to Discover, select the playlist, click "Discover"
|
||||||
|
5. Save some recommendations
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## External Access for Testers
|
||||||
|
|
||||||
|
To let others test without deploying to a server, use a **Cloudflare Tunnel** (free).
|
||||||
|
|
||||||
|
### Setup Cloudflare Tunnel
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install cloudflared
|
||||||
|
curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -o /usr/local/bin/cloudflared
|
||||||
|
chmod +x /usr/local/bin/cloudflared
|
||||||
|
|
||||||
|
# Login (one time)
|
||||||
|
cloudflared tunnel login
|
||||||
|
|
||||||
|
# Create a tunnel
|
||||||
|
cloudflared tunnel create vynl-test
|
||||||
|
|
||||||
|
# Run the tunnel (points to your local frontend)
|
||||||
|
cloudflared tunnel --url http://localhost:5173 run vynl-test
|
||||||
|
```
|
||||||
|
|
||||||
|
This gives you a URL like `https://vynl-test-xxxxx.cfargotunnel.com` that anyone can access.
|
||||||
|
|
||||||
|
### Or use the quick method (no account needed)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cloudflared tunnel --url http://localhost:5173
|
||||||
|
```
|
||||||
|
|
||||||
|
This creates a temporary public URL instantly. Share it with testers. It expires when you stop the command.
|
||||||
|
|
||||||
|
### Important for external access
|
||||||
|
|
||||||
|
When using a tunnel, update `backend/.env`:
|
||||||
|
```
|
||||||
|
FRONTEND_URL=https://your-tunnel-url.cfargotunnel.com
|
||||||
|
SPOTIFY_REDIRECT_URI=https://your-tunnel-url.cfargotunnel.com/auth/spotify/callback
|
||||||
|
```
|
||||||
|
|
||||||
|
And add the tunnel URL as a redirect URI in your Spotify Developer App settings.
|
||||||
|
|
||||||
|
Then restart the backend:
|
||||||
|
```bash
|
||||||
|
docker compose restart backend
|
||||||
|
```
|
||||||
@@ -17,7 +17,7 @@ class Settings(BaseSettings):
|
|||||||
# Spotify
|
# Spotify
|
||||||
SPOTIFY_CLIENT_ID: str = ""
|
SPOTIFY_CLIENT_ID: str = ""
|
||||||
SPOTIFY_CLIENT_SECRET: str = ""
|
SPOTIFY_CLIENT_SECRET: str = ""
|
||||||
SPOTIFY_REDIRECT_URI: str = "https://deepcutsai.com/auth/spotify/callback"
|
SPOTIFY_REDIRECT_URI: str = "http://localhost:5173/auth/spotify/callback"
|
||||||
|
|
||||||
# Claude API
|
# Claude API
|
||||||
ANTHROPIC_API_KEY: str = ""
|
ANTHROPIC_API_KEY: str = ""
|
||||||
@@ -29,7 +29,7 @@ class Settings(BaseSettings):
|
|||||||
STRIPE_WEBHOOK_SECRET: str = ""
|
STRIPE_WEBHOOK_SECRET: str = ""
|
||||||
|
|
||||||
# Frontend
|
# Frontend
|
||||||
FRONTEND_URL: str = "https://deepcutsai.com"
|
FRONTEND_URL: str = "http://localhost:5173"
|
||||||
|
|
||||||
# Rate limits (free tier)
|
# Rate limits (free tier)
|
||||||
FREE_DAILY_RECOMMENDATIONS: int = 10
|
FREE_DAILY_RECOMMENDATIONS: int = 10
|
||||||
|
|||||||
Reference in New Issue
Block a user