|
| 1 | +# 🚀 AutoDeploy |
| 2 | + |
| 3 | +### _Auto-Generated, Secure CI/CD Pipelines with AI + MCP_ |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 🧭 Overview |
| 8 | + |
| 9 | +**AutoDeploy** is a modular platform that automatically provisions and manages secure CI/CD pipelines powered by **AI orchestration (MCP)**. |
| 10 | +It integrates seamlessly with **GitHub Actions**, **Supabase**, and **AWS**, while keeping security and transparency at its core. |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +## 📦 Tech Stack |
| 15 | + |
| 16 | +| Layer | Technology | Description | |
| 17 | +| :----------- | :---------------------------------------- | :------------------------------------------------- | |
| 18 | +| **Frontend** | React • Tailwind • Zustand | Developer dashboard (by Victoria) | |
| 19 | +| **Backend** | Node.js • Express • PostgreSQL (Supabase) | Orchestration + OAuth + API services (by Lorenc) | |
| 20 | +| **Infra** | AWS • Terraform • GitHub Actions (OIDC) | Cloud deployment and workflow automation (by Alex) | |
| 21 | +| **Testing** | Jest • Supertest • Integration scripts | Unit and integration coverage (by Paython) | |
| 22 | + |
| 23 | +--- |
| 24 | + |
| 25 | +## 🗂️ Project Structure |
| 26 | + |
| 27 | +```bash |
| 28 | +mcp-ci-cd-builder/ |
| 29 | +├── client/ # React + Tailwind + Zustand frontend |
| 30 | +│ ├── src/ |
| 31 | +│ ├── public/ |
| 32 | +│ └── package.json |
| 33 | +├── server/ # MCP orchestrator + adapters |
| 34 | +│ ├── src/ |
| 35 | +│ ├── routes/ |
| 36 | +│ ├── lib/ |
| 37 | +│ ├── db.js |
| 38 | +│ ├── server.js |
| 39 | +│ └── package.json |
| 40 | +├── infra/ # AWS OIDC + GitHub Actions + Terraform |
| 41 | +│ ├── workflows/ |
| 42 | +│ └── terraform/ |
| 43 | +├── tests/ # Shared test utilities |
| 44 | +│ ├── integration/ |
| 45 | +│ └── unit/ |
| 46 | +├── .github/workflows/ # CI configuration |
| 47 | +│ └── ci.yml |
| 48 | +├── .env.example |
| 49 | +└── README.md |
| 50 | +``` |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +## ⚙️ Backend Architecture |
| 55 | + |
| 56 | +### 🧩 OAuth + User Flow (GitHub) |
| 57 | + |
| 58 | +```mermaid |
| 59 | +sequenceDiagram |
| 60 | +Frontend ->> Backend: GET /auth/github/start |
| 61 | +Backend ->> GitHub: Redirect user to OAuth consent |
| 62 | +GitHub ->> Backend: Redirect back with code & state |
| 63 | +Backend ->> GitHub: POST /login/oauth/access_token |
| 64 | +GitHub ->> Backend: Returns access_token |
| 65 | +Backend ->> GitHub: GET /user, GET /user/emails |
| 66 | +Backend ->> Supabase: Upsert users + connections |
| 67 | +Backend ->> Frontend: Redirect / JSON success |
| 68 | +``` |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +### 📁 Server Layout |
| 73 | + |
| 74 | +```bash |
| 75 | +AutoDeploy/ |
| 76 | +├── server/ |
| 77 | +│ ├── lib/ |
| 78 | +│ │ ├── state.js # CSRF state store (in-memory) |
| 79 | +│ │ └── github-oauth.js # GitHub API helpers |
| 80 | +│ ├── routes/ |
| 81 | +│ │ ├── auth.github.js # OAuth routes |
| 82 | +│ │ ├── deployments.js # Deployment logs API |
| 83 | +│ │ └── usersRoutes.js # User CRUD endpoints |
| 84 | +│ ├── server.js # Express bootstrap |
| 85 | +│ ├── auth.js # Generate CSRF protection token |
| 86 | +│ ├── db.js # Postgres pool + healthCheck() |
| 87 | +│ └── ... |
| 88 | +├── .env |
| 89 | +└── package.json |
| 90 | +``` |
| 91 | + |
| 92 | +--- |
| 93 | + |
| 94 | +## ✅ Current Functionality |
| 95 | + |
| 96 | +| Component | Status | Description | |
| 97 | +| :-------------------- | :----: | :------------------------------------------------- | |
| 98 | +| **Express App** | ✅ | Clean middleware: CORS, Helmet, JSON, Morgan | |
| 99 | +| **Database** | ✅ | Supabase-hosted PostgreSQL connection | |
| 100 | +| **/health** | ✅ | Service uptime | |
| 101 | +| **/db/ping** | ✅ | Database readiness check | |
| 102 | +| **/users (POST/GET)** | ✅ | User creation + listing | |
| 103 | +| **/auth/github/** | ✅ | Full OAuth 2.0 flow implemented | |
| 104 | +| **/auth/github/me** | ✅ | Verifies stored token + fetches GitHub user | |
| 105 | +| **/deployments** | ⚙️ | Deployment logging API (WIP dashboard integration) | |
| 106 | + |
| 107 | +--- |
| 108 | + |
| 109 | +## 🧱 Deployment Logs API |
| 110 | + |
| 111 | +The **Deployment Logs API** provides a lightweight, flexible record of deployment activity from **GitHub Actions** or other CI/CD providers. |
| 112 | +It’s designed to power AutoDeploy’s build history and performance dashboards. |
| 113 | + |
| 114 | +### 🧩 Schema Highlights |
| 115 | + |
| 116 | +- **Status tracking:** `queued`, `running`, `success`, `failed`, `canceled` |
| 117 | +- **Context:** `provider`, `repo_full_name`, `environment`, `branch` |
| 118 | +- **Timing:** `started_at`, `finished_at`, auto-computed `duration_ms` |
| 119 | +- **Metadata:** flexible JSON for provider-specific fields (e.g., run IDs, AWS region) |
| 120 | + |
| 121 | +--- |
| 122 | + |
| 123 | +### 🔌 Endpoints |
| 124 | + |
| 125 | +| Method | Endpoint | Description | |
| 126 | +| :-------- | :------------------------ | :------------------------------------------------- | |
| 127 | +| **POST** | `/deployments` | Create a new deployment record (`status = queued`) | |
| 128 | +| **PATCH** | `/deployments/:id/status` | Update status and merge metadata | |
| 129 | +| **GET** | `/deployments` | List deployments (filter by repo/env/status) | |
| 130 | +| **GET** | `/deployments/:id` | Retrieve a single deployment record by ID | |
| 131 | + |
| 132 | +--- |
| 133 | + |
| 134 | +### 🧠 Example Metadata |
| 135 | + |
| 136 | +```json |
| 137 | +{ |
| 138 | + "gha_run_id": 5823438279, |
| 139 | + "gha_job_id": 987654321, |
| 140 | + "gha_url": "https://github.com/lorencd/AutoDeploy/actions/runs/5823438279/job/987654321", |
| 141 | + "aws_region": "us-east-1" |
| 142 | +} |
| 143 | +``` |
| 144 | + |
| 145 | +--- |
| 146 | + |
| 147 | +## 🔒 Key Features |
| 148 | + |
| 149 | +- 🔐 **CSRF protection** using secure OAuth `state` store |
| 150 | +- 🔁 **Idempotent upserts** for users & connections |
| 151 | +- 🧩 **Zod validation** for API payloads |
| 152 | +- 🧠 **GitHub token verification** before every usage |
| 153 | +- 🗄️ **Structured metadata logging** for deployments |
| 154 | +- 🧰 **Postgres enum types** for consistent deployment statuses |
| 155 | + |
| 156 | +--- |
| 157 | + |
| 158 | +## 🧰 Environment Setup |
| 159 | + |
| 160 | +```bash |
| 161 | +# 1. Clone the repo |
| 162 | +git clone https://github.com/oslabs-beta/AutoDeploy.git |
| 163 | + |
| 164 | +# 2. Install dependencies |
| 165 | +cd server && npm install |
| 166 | + |
| 167 | +# 3. Create your .env file |
| 168 | +cp .env.example .env |
| 169 | + |
| 170 | +# 4. Run the backend |
| 171 | +npm run dev |
| 172 | + |
| 173 | +# 5. Visit the app |
| 174 | +http://localhost:3000 |
| 175 | +``` |
| 176 | + |
| 177 | +--- |
| 178 | + |
| 179 | +## 🧩 Future Roadmap |
| 180 | + |
| 181 | +- [ ] 🔑 Encrypt GitHub tokens at rest |
| 182 | +- [ ] 🔄 Add PKCE support to OAuth flow |
| 183 | +- [ ] 📊 Frontend deployment dashboard |
| 184 | +- [ ] 🧵 Slack notifications for failed deploys |
| 185 | +- [ ] 🧪 Integration tests for deployment API |
| 186 | + |
| 187 | +--- |
| 188 | + |
| 189 | +## 🧾 License |
| 190 | + |
| 191 | +MIT © 2025 AutoDeploy Team |
0 commit comments