Spaces:
Running
Running
File size: 25,539 Bytes
3e97bfd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Code Assistant - Complete Project Setup</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.terminal {
background-color: #1e1e1e;
color: #f8f8f2;
font-family: 'Courier New', monospace;
border-radius: 8px;
padding: 1rem;
overflow-x: auto;
}
.command {
color: #50fa7b;
}
.comment {
color: #6272a4;
}
.error {
color: #ff5555;
}
.success {
color: #50fa7b;
}
.warning {
color: #f1fa8c;
}
.highlight {
background-color: #44475a;
padding: 0.2rem 0.4rem;
border-radius: 4px;
}
.progress-bar {
height: 6px;
background-color: #e5e7eb;
border-radius: 3px;
overflow: hidden;
}
.progress-fill {
height: 100%;
background-color: #3b82f6;
width: 75%;
transition: width 0.3s ease;
}
.tab-active {
border-bottom: 3px solid #3b82f6;
color: #3b82f6;
font-weight: 600;
}
</style>
</head>
<body class="bg-gray-100 font-sans">
<div class="container mx-auto max-w-6xl px-4 py-8">
<div class="bg-white rounded-xl shadow-lg overflow-hidden mb-8">
<div class="p-6">
<div class="flex justify-between items-center mb-6">
<div>
<h1 class="text-3xl font-bold text-gray-800 mb-1">AI Code Assistant</h1>
<p class="text-gray-600">Complete Full-Stack Project Setup for AI-Powered Development</p>
</div>
<div class="flex items-center space-x-2">
<span class="px-3 py-1 bg-blue-100 text-blue-800 rounded-full text-sm font-medium">v1.0.0</span>
<span class="px-3 py-1 bg-green-100 text-green-800 rounded-full text-sm font-medium">Active</span>
</div>
</div>
<div class="progress-bar mb-8">
<div class="progress-fill"></div>
</div>
<div class="flex space-x-4 border-b mb-6">
<button class="px-4 py-2 tab-active">Setup</button>
<button class="px-4 py-2 text-gray-500 hover:text-gray-800">Configuration</button>
<button class="px-4 py-2 text-gray-500 hover:text-gray-800">Deployment</button>
<button class="px-4 py-2 text-gray-500 hover:text-gray-800">Monitoring</button>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
<div class="bg-gray-50 p-4 rounded-lg border border-gray-200">
<div class="flex items-center mb-3">
<i class="fas fa-laptop-code text-blue-500 mr-2 text-xl"></i>
<h3 class="font-semibold text-lg">Frontend Stack</h3>
</div>
<ul class="space-y-2">
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>React 18 + TypeScript 5</li>
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>Tailwind CSS 3.3</li>
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>Monaco Editor 0.40</li>
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>Vite 4.3</li>
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>React Router 6</li>
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>Zustand 4.0</li>
</ul>
</div>
<div class="bg-gray-50 p-4 rounded-lg border border-gray-200">
<div class="flex items-center mb-3">
<i class="fas fa-server text-purple-500 mr-2 text-xl"></i>
<h3 class="font-semibold text-lg">Backend Stack</h3>
</div>
<ul class="space-y-2">
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>Node.js 18 + Express 4.18</li>
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>WebSocket (ws 8.13)</li>
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>JWT Authentication</li>
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>PostgreSQL 15</li>
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>Prisma 4.0</li>
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>Redis 4.6</li>
</ul>
</div>
<div class="bg-gray-50 p-4 rounded-lg border border-gray-200">
<div class="flex items-center mb-3">
<i class="fas fa-code-branch text-orange-500 mr-2 text-xl"></i>
<h3 class="font-semibold text-lg">DevOps & Tools</h3>
</div>
<ul class="space-y-2">
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>GitHub Actions</li>
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>Docker + Compose</li>
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>ESLint + Prettier</li>
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>Jest + Testing Library</li>
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>Husky 8.0</li>
<li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i>Prometheus + Grafana</li>
</ul>
</div>
</div>
<div class="bg-yellow-50 border-l-4 border-yellow-400 p-4 mb-6">
<div class="flex">
<div class="flex-shrink-0">
<i class="fas fa-exclamation-triangle text-yellow-500 text-xl mr-3 mt-1"></i>
</div>
<div>
<h3 class="text-sm font-medium text-yellow-800">Important Note</h3>
<div class="mt-1 text-sm text-yellow-700">
<p>Before proceeding, ensure you have Node.js v18+, Docker, and PostgreSQL installed on your system. The setup assumes you have basic familiarity with terminal commands.</p>
</div>
</div>
</div>
</div>
<h2 class="text-2xl font-bold text-gray-800 mb-4 flex items-center">
<i class="fas fa-terminal mr-2 text-blue-500"></i>
Project Initialization
</h2>
<div class="terminal mb-6">
<div class="mb-4">
<span class="comment"># Create project directory structure and initialize git repository</span><br>
<span class="command">mkdir -p ai-code-assistant/{client,server,scripts,docs} && cd ai-code-assistant</span><br>
<span class="command">git init</span><br>
<span class="command">echo "# AI Code Assistant - Full Stack Project" >> README.md</span><br>
<span class="command">echo "Project structure:" >> README.md</span><br>
<span class="command">echo "- client: Frontend React application" >> README.md</span><br>
<span class="command">echo "- server: Backend Node.js service" >> README.md</span><br>
<span class="command">echo "- scripts: Deployment and utility scripts" >> README.md</span><br>
<span class="command">echo "- docs: Project documentation" >> README.md</span>
</div>
<div class="mb-4">
<span class="comment"># Initialize frontend with Vite + React + TypeScript</span><br>
<span class="command">npm create vite@latest client -- --template react-ts</span><br>
<span class="command">cd client && npm install</span><br>
<span class="command">npm install @monaco-editor/react @uiw/react-markdown-preview</span><br>
<span class="command">npm install tailwindcss postcss autoprefixer @tailwindcss/typography</span><br>
<span class="command">npx tailwindcss init -p</span><br>
<span class="command">npm install react-router-dom @tanstack/react-query zustand</span><br>
<span class="command">npm install --save-dev @types/node @types/react @types/react-dom</span>
</div>
<div class="mb-4">
<span class="comment"># Initialize backend with Node.js + Express + TypeScript</span><br>
<span class="command">cd .. && mkdir server && cd server</span><br>
<span class="command">npm init -y</span><br>
<span class="command">npm install express typescript ts-node @types/node @types/express</span><br>
<span class="command">npm install ws jsonwebtoken pg pg-hstore dotenv cors</span><br>
<span class="command">npm install prisma @prisma/client redis</span><br>
<span class="command">npm install --save-dev @types/ws @types/jsonwebtoken @types/cors</span><br>
<span class="command">npx tsc --init --outDir dist --rootDir src --module commonjs</span><br>
<span class="command">npx prisma init</span>
</div>
<div class="mb-4">
<span class="comment"># Set up development tools and configuration</span><br>
<span class="command">npm install -g concurrently</span><br>
<span class="command">cd .. && echo "node_modules" >> .gitignore</span><br>
<span class="command">echo "client/node_modules" >> .gitignore</span><br>
<span class="command">echo "server/node_modules" >> .gitignore</span><br>
<span class="command">echo "dist" >> .gitignore</span><br>
<span class="command">echo ".env" >> .gitignore</span><br>
<span class="command">echo ".DS_Store" >> .gitignore</span><br>
<span class="command">echo "*.log" >> .gitignore</span>
</div>
</div>
<h2 class="text-2xl font-bold text-gray-800 mb-4 flex items-center">
<i class="fab fa-github mr-2 text-purple-500"></i>
GitHub Repository Setup
</h2>
<div class="terminal mb-6">
<div class="mb-4">
<span class="comment"># Create new repository on GitHub (manually through UI)</span><br>
<span class="comment"># Then link to local repository and push initial code:</span><br>
<span class="command">git remote add origin https://github.com/yourusername/ai-code-assistant.git</span><br>
<span class="command">git branch -M main</span><br>
<span class="command">git add .</span><br>
<span class="command">git commit -m "Initial project setup"</span><br>
<span class="command">git push -u origin main</span><br>
<span class="success">✓ Successfully pushed initial commit to GitHub</span>
</div>
</div>
<h2 class="text-2xl font-bold text-gray-800 mb-4 flex items-center">
<i class="fas fa-vial mr-2 text-green-500"></i>
Automated Testing Setup
</h2>
<div class="terminal mb-6">
<div class="mb-4">
<span class="comment"># Frontend testing configuration (React)</span><br>
<span class="command">cd client && npm install --save-dev jest @testing-library/react</span><br>
<span class="command">npm install @testing-library/jest-dom @testing-library/user-event</span><br>
<span class="command">npm install --save-dev @types/jest jest-environment-jsdom</span><br>
<span class="command">echo "module.exports = {" > jest.config.js</span><br>
<span class="command">echo " preset: 'ts-jest'," >> jest.config.js</span><br>
<span class="command">echo " testEnvironment: 'jsdom'," >> jest.config.js</span><br>
<span class="command">echo " setupFilesAfterEnv: ['<rootDir>/jest.setup.ts']," >> jest.config.js</span><br>
<span class="command">echo " moduleNameMapper: {" >> jest.config.js</span><br>
<span class="command">echo " '^@/(.*)$': '<rootDir>/src/$1'" >> jest.config.js</span><br>
<span class="command">echo " }" >> jest.config.js</span><br>
<span class="command">echo "}" >> jest.config.js</span><br>
<span class="command">echo "import '@testing-library/jest-dom';" > jest.setup.ts</span>
</div>
<div class="mb-4">
<span class="comment"># Backend testing configuration (Node.js)</span><br>
<span class="command">cd ../server && npm install --save-dev jest ts-jest @types/jest</span><br>
<span class="command">npm install supertest @types/supertest</span><br>
<span class="command">echo "module.exports = {" > jest.config.js</span><br>
<span class="command">echo " preset: 'ts-jest'," >> jest.config.js</span><br>
<span class="command">echo " testEnvironment: 'node'," >> jest.config.js</span><br>
<span class="command">echo " testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$'," >> jest.config.js</span><br>
<span class="command">echo " moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node']," >> jest.config.js</span><br>
<span class="command">echo " collectCoverage: true," >> jest.config.js</span><br>
<span class="command">echo " coverageDirectory: 'coverage'," >> jest.config.js</span><br>
<span class="command">echo " coverageReporters: ['text', 'lcov']" >> jest.config.js</span><br>
<span class="command">echo "}" >> jest.config.js</span>
</div>
<div class="mb-4">
<span class="comment"># Add test scripts to package.json</span><br>
<span class="command">npm pkg set scripts.test="jest"</span><br>
<span class="command">npm pkg set scripts.test:watch="jest --watch"</span><br>
<span class="command">npm pkg set scripts.test:coverage="jest --coverage"</span><br>
<span class="success">✓ Testing setup complete for both frontend and backend</span>
</div>
</div>
<h2 class="text-2xl font-bold text-gray-800 mb-4 flex items-center">
<i class="fas fa-rocket mr-2 text-orange-500"></i>
CI/CD Pipeline Configuration
</h2>
<div class="terminal mb-6">
<div class="mb-4">
<span class="comment"># Create GitHub Actions workflow for automated testing and deployment</span><br>
<span class="command">mkdir -p .github/workflows</span><br>
<span class="command">cat > .github/workflows/main.yml << 'EOF'</span><br>
<span>name: CI/CD Pipeline</span><br>
<span>on:</span><br>
<span> push:</span><br>
<span> branches: [ main ]</span><br>
<span> pull_request:</span><br>
<span> branches: [ main ]</span><br>
<span>jobs:</span><br>
<span> build-and-test:</span><br>
<span> name: Build and Test</span><br>
<span> runs-on: ubuntu-latest</span><br>
<span> services:</span><br>
<span> postgres:</span><br>
<span> image: postgres:15</span><br>
<span> env:</span><br>
<span> POSTGRES_PASSWORD: postgres</span><br>
<span> POSTGRES_USER: postgres</span><br>
<span> POSTGRES_DB: test</span><br>
<span> ports:</span><br>
<span> - 5432:5432</span><br>
<span> options: >-</span><br>
<span> --health-cmd pg_isready</span><br>
<span> --health-interval 10s</span><br>
<span> --health-timeout 5s</span><br>
<span> --health-retries 5</span><br>
<span> redis:</span><br>
<span> image: redis</span><br>
<span> ports:</span><br>
<span> - 6379:6379</span><br>
<span> steps:</span><br>
<span> - uses: actions/checkout@v3</span><br>
<span> - name: Set up Node.js</span><br>
<span> uses: actions/setup-node@v3</span><br>
<span> with:</span><br>
<span> node-version: '18'</span><br>
<span> cache: 'npm'</span><br>
<span> - name: Install dependencies</span><br>
<span> run: |</span><br>
<span> cd client && npm install</span><br>
<span> cd ../server && npm install</span><br>
<span> - name: Run client tests</span><br>
<span> run: cd client && npm test</span><br>
<span> - name: Run server tests</span><br>
<span> run: |</span><br>
<span> cd server</span><br>
<span> npm run build</span><br>
<span> npm test</span><br>
<span> - name: Build production</span><br>
<span> run: cd client && npm run build</span><br>
<span> - name: Docker build</span><br>
<span> run: |</span><br>
<span> docker build -t ai-code-assistant-client ./client</span><br>
<span> docker build -t ai-code-assistant-server ./server</span><br>
<span> deploy:</span><br>
<span> name: Deploy to Production</span><br>
<span> needs: build-and-test</span><br>
<span> runs-on: ubuntu-latest</span><br>
<span> if: github.ref == 'refs/heads/main'</span><br>
<span> steps:</span><br>
<span> - uses: actions/checkout@v3</span><br>
<span> - name: Install DigitalOcean CLI</span><br>
<span> run: |</span><br>
<span> curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -</span><br>
<span> sudo apt-get install -y nodejs</span><br>
<span> sudo npm install -g doctl</span><br>
<span> - name: Configure DigitalOcean CLI</span><br>
<span> run: doctl auth init --access-token ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}</span><br>
<span> - name: Deploy to DigitalOcean App Platform</span><br>
<span> run: doctl apps create --spec ./.do/app.yaml</span><br>
<span>EOF</span>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
<div class="bg-green-50 p-4 rounded-lg border border-green-200">
<h3 class="font-semibold text-lg mb-3 text-green-800 flex items-center">
<i class="fas fa-check-circle mr-2"></i>
Setup Complete
</h3>
<p class="text-green-700 mb-3">Your AI Code Assistant project is now fully configured with:</p>
<ul class="list-disc list-inside space-y-1 text-green-700">
<li>Modern frontend with React + TypeScript</li>
<li>Scalable backend with Node.js + Express</li>
<li>Automated testing infrastructure</li>
<li>CI/CD pipeline ready for deployment</li>
<li>Docker containers for all services</li>
</ul>
</div>
<div class="bg-blue-50 p-4 rounded-lg border border-blue-200">
<h3 class="font-semibold text-lg mb-3 text-blue-800 flex items-center">
<i class="fas fa-forward mr-2"></i>
Next Steps
</h3>
<ol class="list-decimal list-inside space-y-1 text-blue-700">
<li>Implement WebSocket connection for real-time collaboration</li>
<li>Set up authentication system with JWT</li>
<li>Create database schema for code snippets and user data</li>
<li>Integrate with AI APIs (OpenAI, Anthropic, etc.)</li>
<li>Develop the Monaco Editor interface with custom language support</li>
<li>Configure monitoring with Prometheus and Grafana</li>
</ol>
</div>
</div>
<div class="flex justify-between items-center mt-8 pt-6 border-t">
<button class="px-4 py-2 bg-gray-100 text-gray-700 rounded hover:bg-gray-200">
<i class="fas fa-arrow-left mr-2"></i> Back
</button>
<button class="px-6 py-2 bg-blue-600 text-white rounded hover:bg-blue-700">
Continue to Configuration <i class="fas fa-arrow-right ml-2"></i>
</button>
</div>
</div>
</div>
</div>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=scottzillA/ai-code-assistant" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |