A full-stack trading strategy backtesting platform with subscription-based access to real market data and advanced features. Built with modern web technologies and designed for scalability.
Backtester follows a microservices architecture with four primary components:
- Frontend (Astro + React) - User interface on port 4321
- Auth Backend (Node.js + Better Auth) - Authentication and Stripe webhooks on port 3001
- Main Backend (Rust + Axum) - Core business logic and API on port 3000
- Database (PostgreSQL) - User data and application state
- Frontend: Astro, React, TypeScript, Tailwind CSS
- Authentication: Better Auth with PostgreSQL
- Payments: Stripe (Checkout, Billing Portal, Webhooks)
- Backend: Rust (Axum framework)
- Database: PostgreSQL
- Development: Stripe CLI for webhook testing
Before setting up the development environment, ensure you have the following installed:
- Node.js (v18 or higher)
- npm (v9 or higher)
- Rust (latest stable version)
- PostgreSQL (v14 or higher)
- Stripe CLI (for webhook testing)
brew install stripe/stripe-cli/stripe
git clone <repository-url>
cd atlas
# Install frontend dependencies
cd frontend
npm install
# Install auth backend dependencies
cd ../auth_backend
npm install
# Install stripe server dependencies (dev only)
cd ../stripe-server
npm install
# Build Rust backend
cd ../backend
cargo buildCreate a PostgreSQL database and user:
psql postgres
CREATE DATABASE devdb;
CREATE USER user WITH PASSWORD 'password';
GRANT ALL PRIVILEGES ON DATABASE devdb TO user;
\qRun database migrations:
cd auth_backend
psql postgres://user:password@localhost/devdb -f better-auth_migrations/2026-01-13T08-22-12.000Z.sqlCreate a .env file in the project root:
# Database Configuration
POSTGRES_USER=user
POSTGRES_PASSWORD=password
POSTGRES_DB=devdb
DATABASE_URL=postgres://user:password@localhost/devdb
# Better Auth Configuration
BETTER_AUTH_SECRET=<generate-a-random-secret>
BETTER_AUTH_URL=http://localhost:3001
# Stripe Configuration
STRIPE_SECRET_KEY=<your-stripe-test-key>
STRIPE_WEBHOOK_SECRET=<from-stripe-cli-or-dashboard>Getting Stripe Keys:
- Get
STRIPE_SECRET_KEYfrom Stripe Dashboard → Developers → API Keys - Get
STRIPE_WEBHOOK_SECRETby runningstripe listen --forward-to localhost:3001/api/stripe/webhook(see below)
Generate Better Auth Secret:
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"You need to run five services simultaneously. Open separate terminal windows for each:
cd auth_backend
npm run devServer starts on http://localhost:3001
cd backend
cargo runServer starts on http://localhost:3000
cd frontend
npm run devApplication available at http://localhost:4321
stripe login
stripe listen --forward-to localhost:3001/api/stripe/webhookCopy the webhook signing secret (starts with whsec_) to your .env file as STRIPE_WEBHOOK_SECRET.
cd stripe-server
npm startServer starts on http://localhost:4242 (used for testing checkout flows)
atlas/
├── frontend/ # Astro + React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── lib/ # Auth client and utilities
│ │ ├── middleware.ts # Route protection
│ │ └── pages/ # Astro pages
│ └── package.json
├── auth_backend/ # Better Auth + Stripe webhooks
│ ├── src/
│ │ ├── auth.ts # Better Auth configuration
│ │ └── index.ts # Express server + webhook handler
│ ├── better-auth_migrations/ # Database migrations
│ └── package.json
├── backend/ # Rust/Axum main backend
│ ├── src/
│ │ ├── api/ # API endpoints
│ │ └── main.rs
│ └── Cargo.toml
├── stripe-server/ # Test Stripe server (dev only)
│ └── server.js
└── .env # Environment variables (not committed)
The application supports three subscription tiers:
- Free - Limited features with sample data
- Basic ($9/month) - Real market data and backtesting
- Pro (future) - Advanced features and analytics
Go to Stripe Dashboard → Products and create a product with:
- Name: "Backtester Basic Test License"
- Price: $9.00/month (recurring)
- Lookup Key:
Backtester_Basic_Test_License-a40d0ed
- Sign up for an account at http://localhost:4321/signup
- Log in at http://localhost:4321/login
- Navigate to http://localhost:4321/subscription
- Click "Checkout"
- Use Stripe test card:
4242 4242 4242 4242, any future expiry, any CVC - Complete checkout
- Verify webhook updates user's
subscriptionTiertobasicin database
psql postgres://user:password@localhost/devdb
SELECT id, email, "subscriptionTier", stripe_customer_id, stripe_subscription_status FROM "user";- After subscribing, click your profile avatar
- Select "Manage Subscription"
- Stripe Billing Portal should open
- Test canceling/updating subscription
Symptom: Subscription tier not updating after checkout
Solution: Ensure stripe listen is running and STRIPE_WEBHOOK_SECRET in .env matches the output:
stripe listen --forward-to localhost:3001/api/stripe/webhookCopy the whsec_... secret to your .env file and restart the auth backend.
Symptom: Frontend requests blocked by CORS policy
Solution: Verify all servers are running on correct ports:
- Frontend: 4321
- Main Backend: 3000
- Auth Backend: 3001
- Stripe Server: 4242
Symptom: FATAL: password authentication failed
Solution: Verify PostgreSQL is running and credentials in .env match your database:
psql postgres://user:password@localhost/devdbSymptom: Build fails with type errors
Solution: Ensure all dependencies are installed:
cd frontend
rm -rf node_modules package-lock.json
npm installServices Required in Production:
- Auth Backend (Better Auth + Stripe webhooks)
- Main Backend (Rust/Axum)
- Frontend (Astro SSR or static export)
Services NOT Needed:
- Stripe server (port 4242) - dev/test only
- Stripe CLI webhook forwarding - use Stripe Dashboard webhooks
Production Webhook Setup:
- Deploy auth backend to production URL
- In Stripe Dashboard → Webhooks, add endpoint:
https://yourdomain.com/api/stripe/webhook - Select events:
checkout.session.completed,customer.subscription.updated,customer.subscription.deleted - Copy production webhook secret to production environment variables
- Update frontend URLs to use production endpoints
- Create a feature branch
- Make changes
- Test locally with all services running
- Submit pull request
[Your License Here]