Project: Startup Company Data Manager
This repository implements the technical assignment: generate startup company data using an AI model (Anthropic Claude) and provide a FastAPI application to manage that data (load into SQLite + CRUD endpoints).
- Python 3.10 or newer
- An Anthropic API key (only required to run the data generator)
- Modern web browser (Chrome, Firefox, Safari, or Edge)
git clone <repository-url>
cd startup-data-apiWindows (PowerShell):
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txtmacOS/Linux:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtCopy .env.example to .env if you want a local file (NOT recommended for production). Prefer setting the API key in your shell or CI secrets:
Permanent setup (.env file):
# Create .env file in project root
ANTHROPIC_API_KEY=sk-ant-your-api-key-hereRun the generator to create startup_data.json:
python generate_data.pyNotes:
- The generator produces 10 companies (2 per industry: FinTech, HealthTech, EdTech, E-commerce, SaaS)
- Each company includes 3-4 products with detailed information
- If
ANTHROPIC_API_KEYis missing,generate_data.pywill print a clear error and exit - The generated file will be saved as
startup_data.jsonin the project root
Start the API server:
uvicorn main:app --reload --host 127.0.0.1 --port 8000The server will start at: http://127.0.0.1:8000
Open your browser and navigate to:
- Frontend UI: http://127.0.0.1:8000
- API Documentation: http://127.0.0.1:8000/docs
GET /health— Check API health and database statistics
POST /load-data— Load data fromstartup_data.jsoninto the database- Prevents duplicate entries by checking company names
- Returns:
{loaded: n, skipped: m, errors: []}
GET /companies?page=1&per_page=10— Get paginated list of companies- Query params:
page,per_page,industry
- Query params:
GET /companies/{company_id}— Get single company with all productsPOST /companies— Create new companyPUT /companies/{company_id}— Update company detailsDELETE /companies/{company_id}— Delete company (cascade deletes all products)
GET /products?page=1&per_page=10— Get paginated list of products- Query params:
page,per_page,company_id,pricing_model
- Query params:
GET /products/{product_id}— Get single productPOST /products— Create new productPUT /products/{product_id}— Update product detailsDELETE /products/{product_id}— Delete product
The web interface (index.html) provides:
- View total companies, products, and industries
- Load data from JSON file with one click
- Browse all companies with pagination (10 per page)
- Search companies by name, industry, or tagline
- View detailed company information with all products
- Create, update, and delete companies
- Delete all companies (bulk action)
- Browse all products with pagination (10 per page)
- Search products by name, description, or pricing model
- Create, update, and delete products
- Delete all products (bulk action)
- Add new companies with validation
- Add new products linked to existing companies
- Update existing companies and products
startup-data-manager/
├── generate_data.py # AI data generator (Claude API)
├── startup_data.json # Generated data file (created by generator)
├── main.py # FastAPI application with all endpoints
├── models.py # SQLAlchemy database models
├── schemas.py # Pydantic validation schemas
├── database.py # Database configuration (SQLite)
├── index.html # Frontend web interface
├── requirements.txt # Python dependencies
├── .env.example # Example environment variables
├── .gitignore # Git ignore patterns
├── startup.db # SQLite database (created on first run)
└── README.md # This file
id(UUID, Primary Key)name(String, Unique)tagline(String, max 100 chars)description(Text)industry(String: FinTech, HealthTech, EdTech, E-commerce, SaaS)founded_year(Integer)employee_count(Integer)headquarters(String)website_url(String, Optional)
id(UUID, Primary Key)company_id(UUID, Foreign Key → companies.id)name(String)description(Text)target_audience(String)key_features(Text)pricing_model(String: Free, Freemium, Subscription, Enterprise)
Relationship: One Company → Many Products (cascade delete)
Backend:
- FastAPI — Modern Python web framework
- SQLAlchemy — ORM for database operations
- SQLite — Lightweight database
- Pydantic — Data validation
- Anthropic Claude API — AI data generation
Frontend:
- JavaScript — No frameworks required
- CSS3 — Modern dark theme design
- HTML5 — Semantic markup
-
Generate fresh data:
python generate_data.py
-
Start the server:
uvicorn main:app --reload
-
Access the frontend:
- Open http://127.0.0.1:8000 in your browser
If port 8000 is already in use, start the server on a different port:
uvicorn main:app --reload --port 8001Then update API_URL in index.html to match.
To reset the database:
# Delete the database file
rm startup.db # macOS/Linux
del startup.db # Windows
# Restart the server to recreate it
uvicorn main:app --reloadIf you see "ANTHROPIC_API_KEY not found", make sure:
- You've set the environment variable correctly
- You've activated the virtual environment
- The key starts with
sk-ant-
https://drive.google.com/file/d/1k_ctc0kPZYhRn5YZEeOMHXrOZNZd9iJh/view?usp=sharing