Complete guide to setting up Verso-Backend for local development.
The fastest way to get started:
# Clone the repository
git clone https://github.com/versoindustries/verso-backend.git
cd verso-backend
# Run the setup script
chmod +x scripts/setup_local.sh
./scripts/setup_local.sh
# Edit your environment configuration
nano .env # or your preferred editor
# Start development servers
./scripts/setup_local.sh --run| Software | Version | Installation |
|---|---|---|
| Python | 3.10+ | python.org |
| pip | Latest | Included with Python |
| Software | Version | Purpose |
|---|---|---|
| Node.js | 18+ | Frontend build (React Islands) |
| npm | 9+ | Package management |
| Stripe CLI | Latest | Payment webhook testing |
macOS:
brew install stripe/stripe-cli/stripeLinux (Debian/Ubuntu):
# Add Stripe GPG key
curl -s https://packages.stripe.dev/api/security/keypair/stripe-cli-gpg/public | \
gpg --dearmor | sudo tee /usr/share/keyrings/stripe.gpg
# Add repository
echo "deb [signed-by=/usr/share/keyrings/stripe.gpg] https://packages.stripe.dev/stripe-cli-debian-local stable main" | \
sudo tee -a /etc/apt/sources.list.d/stripe.list
# Install
sudo apt update && sudo apt install stripeWindows:
scoop install stripeAfter installation, authenticate:
stripe loginIf you prefer more control, follow these steps:
# Create virtual environment
python3 -m venv env
# Activate (Linux/macOS)
source env/bin/activate
# Activate (Windows)
env\Scripts\activate
# Install dependencies
pip install --upgrade pip
pip install -r requirements.txtnpm install
npm run build # Production build
# or
npm run dev # Development with hot reloadCreate .env in the project root:
cp .env.example .env # If example exists
# or the setup script creates one automatically# Initialize database
python dbl.py # Creates tables
flask db upgrade # Apply migrations
# Seed default data
flask create-roles # Admin, User, Commercial, Blogger
flask seed-business-config # Business hours, timezone, theme# After registering a user, grant admin access:
flask set-admin your_email@example.com| Variable | Description | Example |
|---|---|---|
FLASK_APP |
Flask application | app |
SECRET_KEY |
Session encryption key | your-secure-random-key |
DATABASE_URL |
Database connection | sqlite:///verso.sqlite |
| Variable | Description | Where to Find |
|---|---|---|
STRIPE_PUBLISHABLE_KEY |
Public API key | Stripe Dashboard → API Keys |
STRIPE_SECRET_KEY |
Secret API key | Same as above |
STRIPE_WEBHOOK_SECRET |
Webhook signing secret | Run stripe listen --print-secret |
| Variable | Description | Example |
|---|---|---|
MAIL_SERVER |
SMTP server | smtp.gmail.com |
MAIL_PORT |
SMTP port | 587 |
MAIL_USE_TLS |
Enable TLS | True |
MAIL_USERNAME |
Email username | your_email@gmail.com |
MAIL_PASSWORD |
Email password/app key | your_app_password |
MAIL_DEFAULT_SENDER |
From address | noreply@example.com |
| Variable | Description |
|---|---|
GOOGLE_CLIENT_ID |
Google OAuth client ID |
GOOGLE_CLIENT_SECRET |
Google OAuth secret |
RECAPTCHA_SITE_KEY |
reCAPTCHA site key |
RECAPTCHA_SECRET_KEY |
reCAPTCHA secret key |
| Variable | Description | Default |
|---|---|---|
CACHE_TYPE |
Cache backend | SimpleCache |
CACHE_REDIS_URL |
Redis URL | redis://localhost:6379/0 |
source .venv/bin/activate
flask run --host=0.0.0.0 --debugApplication: http://localhost:5000
Terminal 1 - Flask:
source .venv/bin/activate
flask run --host=0.0.0.0 --debugTerminal 2 - Stripe:
stripe listen --forward-to localhost:5000/webhooks/stripeUse the setup script with --run:
./scripts/setup_local.sh --runThis starts both servers and handles cleanup on Ctrl+C.
The webhook endpoint is: /webhooks/stripe
stripe listen --print-secretCopy the whsec_... value to your .env file as STRIPE_WEBHOOK_SECRET.
checkout.session.completed- Order/booking payment successinvoice.paid- Subscription payment successinvoice.payment_failed- Subscription payment failurecustomer.subscription.updated- Subscription changescustomer.subscription.deleted- Subscription cancellation
Trigger test events:
stripe trigger checkout.session.completed
stripe trigger invoice.paid| Command | Description |
|---|---|
flask create-roles |
Create default user roles |
flask seed-business-config |
Seed business settings |
flask set-admin <email> |
Grant admin role to user |
flask db upgrade |
Apply database migrations |
flask run-worker |
Start background worker |
Ensure your virtual environment is activated:
source .venv/bin/activateReset the database:
rm verso.sqlite # Backup first if needed!
python dbl.py
flask db upgrade
flask create-roles
flask seed-business-configYour webhook secret is incorrect. Get the current secret:
stripe listen --print-secretUpdate STRIPE_WEBHOOK_SECRET in .env.
Rebuild Vite assets:
npm run buildFor development with hot reload:
npm run devFind and kill the process:
lsof -i :5000
kill -9 <PID>| URL | Description |
|---|---|
| http://localhost:5000 | Main application |
| http://localhost:5000/admin | Admin dashboard |
| http://localhost:5000/admin/calendar | Appointment calendar |
| http://localhost:5000/api/docs | API documentation |
| http://localhost:5000/login | User login |
| http://localhost:5000/register | User registration |
- Edit
.envwith your API keys and configuration - Register a user at
/register - Grant admin access:
flask set-admin your@email.com - Access admin panel at
/admin - Customize theme at
/admin/theme - Configure business hours at
/admin/settings
For deployment, see docs/deployment.md.