'''
This project is a fully-autonomous revenue generation system built from the Revenue Engine specification. It integrates multiple services to create, market, sell, and fulfill digital products, with a focus on daily, automated cash flow to Stripe and PayPal.
- Architecture
 - Getting Started
 - Project Structure
 - Database Setup
 - API Setup
 - Frontend Setup
 - Automation Setup
 - Testing
 - Deployment
 - Environment Variables
 - Revenue Strategies
 
The system is built on a modern, decoupled architecture:
- Frontend: A React-based landing page built with Vite, Tailwind CSS, and shadcn/ui. Designed for deployment on Vercel.
 - Backend: A Flask API that handles webhooks (Stripe, PayPal), fulfillment logic, and lead management. Designed for deployment as a Docker container.
 - Database: A PostgreSQL database managed with Prisma. The schema is designed for Supabase but is compatible with any PostgreSQL provider.
 - Automations: Python scripts for recurring tasks like the daily briefing generation, which can be run as cron jobs or triggered by services like Zapier.
 - Testing: End-to-end tests using Playwright and error monitoring with Sentry.
 
| Component | Technology/Service | Purpose | 
|---|---|---|
| Web Properties | React, Webflow | Sales pages, checkout, and member areas. | 
| Payments | Stripe, PayPal | Processing subscriptions and one-time payments. | 
| Database | Supabase/Postgres | Storing leads, products, orders, and KPIs. | 
| API & Webhooks | Flask, Vercel Edge | Handling payment events, fulfillment, and lead intake. | 
| Content Gen | OpenAI, ElevenLabs | Generating blog articles, email copy, and audio briefings. | 
| Automation | Python, Zapier | Orchestrating daily tasks, lead nurturing, and fulfillment. | 
| Observability | Sentry, Playwright | Monitoring for errors, performance, and running E2E tests. | 
| Deployment | Vercel, Docker | Hosting the frontend and backend services. | 
- Node.js (v18+)
 - Python (v3.9+)
 - Docker
 - pnpm
 - Access to a PostgreSQL database (e.g., a free Supabase project)
 
- 
Clone the repository:
git clone <repository-url> cd omni-revenue-agent
 - 
Create and configure your environment file:
cp .env.example .env
Fill in the required values in the
.envfile. See the Environment Variables section for details. - 
Install dependencies for each component:
# API dependencies pip install -r api/requirements.txt # Frontend dependencies cd web/copykit-landing pnpm install cd ../../ # Automation dependencies pip install -r automations/requirements.txt # Testing dependencies pip install -r tests/requirements.txt playwright install
 
/omni-revenue-agent
βββ api/                    # Flask backend API
β   βββ app.py              # Main Flask application
β   βββ requirements.txt    # Python dependencies
βββ automations/            # Standalone automation scripts
β   βββ daily_briefing.py   # A3-briefing-daily automation
β   βββ lead_intake.py      # A1-lead-intake automation
βββ database/               # Database schema and migrations
β   βββ 001_initial_schema.sql # Raw SQL for initial setup
β   βββ schema.prisma       # Prisma schema for ORM
βββ docs/                   # Documentation files
βββ tests/                  # Testing suite
β   βββ e2e_tests.py        # Playwright E2E tests
β   βββ sentry_config.py    # Sentry configuration
βββ web/                    # Frontend applications
β   βββ copykit-landing/    # React landing page project
βββ .env.example            # Example environment variables
βββ Dockerfile              # Dockerfile for the API
βββ README.md               # This file
βββ vercel.json             # Vercel deployment configuration
- 
Get your PostgreSQL connection string from your provider (e.g., Supabase).
 - 
Set the
DATABASE_URLin your.envfile. This URL must include the password for your database user. - 
Apply the initial schema:
You can either run the
001_initial_schema.sqlfile directly against your database or use Prisma to migrate the schema.Using Prisma:
# Generate the Prisma client prisma generate # Push the schema to the database prisma db push
This will create all the tables, enums, and relationships defined in
database/schema.prisma. 
The Flask API is the core of the system, handling webhooks and fulfillment.
- 
Ensure all dependencies are installed:
pip install -r api/requirements.txt
 - 
Run the development server:
python api/app.py
The API will be running at
http://localhost:5000. - 
For production, use a WSGI server like Gunicorn:
gunicorn --bind 0.0.0.0:5000 api.app:app
 
The React landing page is built with Vite.
- 
Navigate to the project directory:
cd web/copykit-landing - 
Ensure dependencies are installed:
pnpm install
 - 
Start the development server:
pnpm run dev
The frontend will be available at
http://localhost:5173. 
The automation scripts are designed to be run on a schedule.
This script fetches market data, scrapes news, generates content with an LLM, and creates audio/video assets.
- 
To run manually:
python automations/daily_briefing.py
 - 
To schedule with cron:
Add the following line to your crontab to run the script daily at 7 AM BST:
0 7 * * * /usr/bin/python3 /path/to/omni-revenue-agent/automations/daily_briefing.py
 
This script is designed to be triggered by a webhook from a form service (like Typeform or Jotform) via Zapier.
- Set up a webhook in your form provider.
 - Configure the webhook to send a 
POSTrequest to your API endpoint (e.g.,https://your-api-domain.com/api/leads). - The 
lead_intake.pyscript contains the logic that will be executed by the API when a new lead is received. 
The project includes an E2E test suite using Playwright.
- 
Ensure testing dependencies are installed:
pip install -r tests/requirements.txt playwright install
 - 
Make sure both the frontend and backend development servers are running.
 - 
Run the test suite:
pytest tests/e2e_tests.py
 
The frontend is optimized for deployment on Vercel.
- Create a new project on Vercel and connect it to your Git repository.
 - Configure the project settings:
- Framework Preset: 
Vite - Build Command: 
pnpm run build - Output Directory: 
web/copykit-landing/dist - Install Command: 
cd web/copykit-landing && pnpm install 
 - Framework Preset: 
 - Add your environment variables to the Vercel project settings.
 - Deploy! Vercel will automatically build and deploy your site.
 
The vercel.json file is included to ensure correct routing and configuration.
The Flask API is designed to be deployed as a Docker container.
- 
Build the Docker image:
docker build -t omni-revenue-agent-api -f Dockerfile . - 
Run the Docker container:
docker run -d -p 5000:5000 --env-file .env omni-revenue-agent-api
This will start the API container and expose it on port 5000. You can deploy this container to any service that supports Docker, such as AWS ECS, Google Cloud Run, or DigitalOcean App Platform.
 
Create a .env file in the root directory and add the following variables. See .env.example for a template.
| Variable | Description | 
|---|---|
DATABASE_URL | 
Required. PostgreSQL connection string. | 
SECRET_KEY | 
Required. Flask secret key for session management. | 
STRIPE_SECRET_KEY | 
Required. Your Stripe secret API key. | 
STRIPE_WEBHOOK_SECRET | 
Required. Your Stripe webhook signing secret. | 
PAYPAL_CLIENT_ID | 
Required. Your PayPal client ID. | 
PAYPAL_CLIENT_SECRET | 
Required. Your PayPal client secret. | 
OPENROUTER_API_KEY | 
Required. Your OpenRouter API key. | 
COHERE_API_KEY | 
Required. Your Cohere API key. | 
ELEVENLABS_API_KEY | 
Required. Your ElevenLabs API key. | 
INVIDEO_API_KEY | 
API key for InVideo. | 
SENTRY_DSN | 
DSN for Sentry error monitoring. | 
POLYGON_API_KEY | 
API key for Polygon.io financial data. | 
FIRECRAWL_API_KEY | 
API key for Firecrawl web scraping. | 
EXPLORIUM_API_KEY | 
API key for Explorium data enrichment. | 
NOTION_API_KEY | 
API key for Notion integration. | 
LINEAR_API_KEY | 
API key for Linear integration. | 
NOTION_CRM_DATABASE_ID | 
ID of the Notion database for CRM records. | 
LINEAR_TEAM_ID | 
ID of the Linear team for creating tasks. | 
This system is pre-configured with two primary revenue strategies:
- 
AI CopyKit Micro-SaaS (
S1-copykit)- Offer: A Β£49/month subscription for weekly ad creatives and landing page copy, or a Β£199 one-time purchase for a full funnel pack.
 - Stack: Webflow, Stripe, PayPal, Supabase, Zapier, Notion.
 
 - 
Daily Markets & Trends Briefing (
S2-signal-briefing)- Offer: A Β£15/month newsletter and audio brief with trading and creator economy insights.
 - Stack: Gmail, Webflow/Notion, Stripe, PayPal, ElevenLabs, InVideo.
 
 
These strategies are designed to generate recurring and one-time revenue through automated content creation and fulfillment. '''