Skip to content

Sanjay-2927/stack-prompt

Repository files navigation

StackPrompt Backend

AI-powered prompt generator backend for developers. Built with FastAPI for speed, clean architecture, and easy deployment.

🚀 Features

  • AI Prompt Generation: Generate frontend, backend, and database prompts based on tech stack selections
  • Multiple AI Providers: Support for OpenAI, Anthropic (Claude), and Google Gemini
  • Flexible Database: Support for SQLite (default), PostgreSQL, and MongoDB
  • Rate Limiting: Built-in rate limiting (50 requests/day for free users)
  • Clean Architecture: Modular, scalable, production-ready codebase
  • Auto Documentation: Automatic API documentation with FastAPI

📁 Project Structure

/backend
  /src
    /routes
    /controllers
    /services
    /templates
    /models
    /db
    /middlewares
    /utils
    /config
  main.py
  requirements.txt
  env.example

🛠 Installation

  1. Clone the repository

    cd backend
  2. Create virtual environment

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Configure environment

    cp env.example .env
    # Edit .env with your API keys and configuration
  5. Initialize database

    python -m alembic upgrade head
  6. Run the server

    uvicorn main:app --reload --host 0.0.0.0 --port 8000

🔑 Environment Variables

See env.example for all configuration options. Key variables:

  • DATABASE_TYPE: sqlite, postgresql, or mongodb
  • DATABASE_URL: Database connection string
  • OPENAI_API_KEY: OpenAI API key
  • ANTHROPIC_API_KEY: Anthropic API key
  • GOOGLE_API_KEY: Google Gemini API key
  • DEFAULT_AI_PROVIDER: openai, anthropic, or gemini
  • RATE_LIMIT_PER_DAY: Rate limit per user (default: 50)

📡 API Endpoints

POST /api/generate

Generate AI prompts based on tech stack selections.

Request Body:

{
  "frontend": "React",
  "backend": "FastAPI",
  "database": "PostgreSQL",
  "requirements": "Build a task management app with user authentication"
}

Response:

{
  "success": true,
  "data": {
    "frontendPrompt": "...",
    "backendPrompt": "...",
    "databasePrompt": "..."
  },
  "timestamp": "2024-01-15T10:30:00Z"
}

GET /api/tech-stacks

Get available tech stack options.

Response:

{
  "frontend": ["React", "Vue.js", "Angular", "Next.js", "Svelte"],
  "backend": ["FastAPI", "Express.js", "NestJS", "Django", "Flask"],
  "database": ["PostgreSQL", "MongoDB", "MySQL", "SQLite", "Redis"]
}

POST /api/save

Save generated prompt to database.

GET /api/history

Get saved prompts for a user.

📚 API Documentation

Once the server is running, visit:

🚢 Deployment

See DEPLOYMENT.md for detailed deployment instructions for:

  • Render
  • Railway
  • Vercel Serverless

📝 License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages