DocsGetting StartedYour First Project

Your First Project

Build a complete Todo application with MCPCodex in under 10 minutes. Learn the fundamentals of AI-assisted development.

What We'll Build

Todo Application Features

  • • ✅ Add, edit, and delete todos
  • • 🎯 Mark todos as complete/incomplete
  • • 💾 SQLite database for persistence
  • • 🎨 Modern React UI with TypeScript
  • • 🚀 API routes with full CRUD operations
  • • 📱 Responsive design
  • • 🔧 Ready for deployment

Frontend

React with TypeScript, modern components, and responsive design.

Backend

API routes with SQLite database and full CRUD operations.

Deployment

One-click deployment to Vercel, Netlify, or your preferred platform.

Step 1: Initialize Your Project

Start by creating a new MCPCodex project. The CLI will guide you through the setup process:

Terminal
# Initialize a new MCPCodex project
mcp init my-todo-app

# Navigate to project directory
cd my-todo-app

# The CLI will ask you a few questions:
# - Project type: web-app
# - Framework: react-typescript
# - Database: sqlite
# - Authentication: jwt
# - Deployment: vercel

# Start development server
mcp dev

Generated Project Structure

my-todo-app/
├── src/
│   ├── components/
│   │   ├── TodoList.tsx
│   │   ├── TodoItem.tsx
│   │   └── AddTodo.tsx
│   ├── pages/
│   │   ├── index.tsx
│   │   └── api/
│   │       └── todos.ts
│   ├── lib/
│   │   ├── database.ts
│   │   └── auth.ts
│   └── styles/
│       └── globals.css
├── mcp.config.js
├── package.json
└── README.md

Step 2: Generate Components with AI

Now comes the magic! Use MCPCodex to generate your application components using natural language:

AI Generation Commands
# Generate a Todo component with AI
mcp generate component "TodoList with add, edit, delete functionality"

# Generate API routes
mcp generate api "CRUD operations for todos with SQLite"

# Generate database schema
mcp generate schema "Todo model with title, description, completed, createdAt"

# Generate tests
mcp generate tests "unit tests for TodoList component"

Generated TodoList Component

Here's what MCPCodex generated for our TodoList component:

src/components/TodoList.tsx
// Generated by MCPCodex AI
import React, { useState, useEffect } from 'react';
import { Todo } from '../types/Todo';
import { TodoItem } from './TodoItem';
import { AddTodo } from './AddTodo';

interface TodoListProps {
  initialTodos?: Todo[];
}

export const TodoList: React.FC<TodoListProps> = ({ initialTodos = [] }) => {
  const [todos, setTodos] = useState<Todo[]>(initialTodos);
  const [loading, setLoading] = useState(false);

  useEffect(() => {
    fetchTodos();
  }, []);

  const fetchTodos = async () => {
    setLoading(true);
    try {
      const response = await fetch('/api/todos');
      const data = await response.json();
      setTodos(data);
    } catch (error) {
      console.error('Failed to fetch todos:', error);
    } finally {
      setLoading(false);
    }
  };

  const addTodo = async (title: string, description: string) => {
    try {
      const response = await fetch('/api/todos', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ title, description }),
      });
      const newTodo = await response.json();
      setTodos([...todos, newTodo]);
    } catch (error) {
      console.error('Failed to add todo:', error);
    }
  };

  const updateTodo = async (id: string, updates: Partial<Todo>) => {
    try {
      const response = await fetch(`/api/todos/${id}`, {
        method: 'PATCH',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(updates),
      });
      const updatedTodo = await response.json();
      setTodos(todos.map(todo => todo.id === id ? updatedTodo : todo));
    } catch (error) {
      console.error('Failed to update todo:', error);
    }
  };

  const deleteTodo = async (id: string) => {
    try {
      await fetch(`/api/todos/${id}`, { method: 'DELETE' });
      setTodos(todos.filter(todo => todo.id !== id));
    } catch (error) {
      console.error('Failed to delete todo:', error);
    }
  };

  if (loading) {
    return <div className="flex justify-center p-8">Loading...</div>;
  }

  return (
    <div className="max-w-2xl mx-auto p-6">
      <h1 className="text-3xl font-bold mb-8 text-center">My Todo App</h1>
      
      <AddTodo onAdd={addTodo} />
      
      <div className="space-y-2 mt-6">
        {todos.map(todo => (
          <TodoItem
            key={todo.id}
            todo={todo}
            onUpdate={updateTodo}
            onDelete={deleteTodo}
          />
        ))}
      </div>
      
      {todos.length === 0 && (
        <div className="text-center text-gray-500 mt-12">
          No todos yet. Add one above to get started!
        </div>
      )}
    </div>
  );
};

Generated API Route

src/pages/api/todos.ts
// Generated API route: pages/api/todos.ts
import { NextApiRequest, NextApiResponse } from 'next';
import { getDatabase } from '../../lib/database';

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
  const db = getDatabase();

  switch (req.method) {
    case 'GET':
      try {
        const todos = db.prepare('SELECT * FROM todos ORDER BY createdAt DESC').all();
        res.status(200).json(todos);
      } catch (error) {
        res.status(500).json({ error: 'Failed to fetch todos' });
      }
      break;

    case 'POST':
      try {
        const { title, description } = req.body;
        const result = db.prepare(
          'INSERT INTO todos (title, description, completed, createdAt) VALUES (?, ?, ?, ?)'
        ).run(title, description, false, new Date().toISOString());
        
        const newTodo = db.prepare('SELECT * FROM todos WHERE id = ?').get(result.lastInsertRowid);
        res.status(201).json(newTodo);
      } catch (error) {
        res.status(500).json({ error: 'Failed to create todo' });
      }
      break;

    default:
      res.setHeader('Allow', ['GET', 'POST']);
      res.status(405).end(`Method ${req.method} Not Allowed`);
  }
}

Step 3: Test Your Application

Your todo application is now ready! Let's test it locally:

# Start the development server
npm run dev

# Or with MCPCodex CLI
mcp dev

# Your app will be available at http://localhost:3000

Test Functionality

  • • Add new todos
  • • Mark todos as complete
  • • Edit existing todos
  • • Delete completed todos
  • • Verify data persistence

Run Tests

# Run generated tests npm test # Run with coverage npm run test:coverage

Step 4: Deploy to Production

Ready to share your app with the world? MCPCodex makes deployment effortless:

Deployment Commands
# Deploy your project
mcp deploy

# MCPCodex will:
# 1. Build your project
# 2. Run tests
# 3. Deploy to your configured platform (Vercel, Netlify, etc.)
# 4. Set up database and environment variables
# 5. Provide you with the live URL

# Monitor deployment
mcp deploy status

# View deployment logs
mcp deploy logs

Deployment Process

MCPCodex handles the entire deployment pipeline automatically:

Build optimization
Test execution
Database setup
Environment configuration
SSL certificate
Live URL generation

Step 5: Enhance Your Application

Your basic todo app is just the beginning! Let's add more features using AI:

Enhancement Commands
# Add more features with AI assistance
mcp generate feature "user authentication with JWT"
mcp generate feature "todo categories and tags"
mcp generate feature "todo due dates and reminders"
mcp generate feature "search and filter functionality"

# Optimize and refactor
mcp refactor --optimize-performance
mcp refactor --improve-accessibility
mcp refactor --add-error-handling

# Generate documentation
mcp generate docs --api
mcp generate docs --components
mcp generate docs --deployment
🔐

Authentication

User login and registration with JWT

🏷️

Categories

Organize todos with tags and categories

📅

Due Dates

Add deadlines and reminder notifications

🔍

Search

Advanced filtering and search functionality

📱

PWA

Progressive Web App with offline support

🎨

Themes

Dark mode and customizable themes

What You've Learned

Core Concepts

  • • Project initialization with mcp init
  • • AI-powered code generation
  • • Full-stack application structure
  • • Database integration patterns
  • • Component-based architecture

Development Workflow

  • • Natural language to code conversion
  • • Automated testing and deployment
  • • Iterative enhancement with AI
  • • Performance optimization
  • • Documentation generation

Next Steps

Ready to Build More?

Explore our extensive library of project templates and tutorials.