Setting Up the Project
Jump to section
Let AI do the scaffolding
Project setup is where AI shines brightest. The commands are well-documented, the patterns are established, and there is very little ambiguity. For PraktickAI, the entire initial setup — both frontend and backend — was done by Claude Code in a single session. It took about 20 minutes.
The trick is to give AI clear instructions about your preferences. Do you want TypeScript or JavaScript? Do you want the App Router or Pages Router? Do you want poetry or uv for Python dependencies? If you do not specify, AI will choose for you — and it might not match your preferences.
Frontend: Next.js with TypeScript
claude "Create a Next.js project with the App Router, TypeScript, and Tailwind CSS.
Use the latest version. Include ESLint config.
Set up the project structure for a bilingual site (cs/en)
using next-intl for internationalization.
The source directory should be src/."AI will run npx create-next-app, install dependencies, set up the directory structure, configure next-intl, and create the initial layout. You review the output. The 80/20 rule applies: AI gets 80% right, and you guide the remaining 20% — things like your preferred folder structure or naming conventions.
Always tell AI to use the latest version of frameworks. AI training data has a cutoff date, so it might default to older patterns. Saying 'use the latest version' makes it check the current docs and use up-to-date APIs.
Backend: Django with Django Ninja
claude "Create a Django project called 'praktickai-backend'.
Use uv for dependency management.
Add Django Ninja for the REST API.
Use django-environ for settings.
Set up a custom User model with email as the username field.
Structure apps under an 'apps/' directory.
Include: accounts, courses, payments apps.
Add a Dockerfile and docker-compose.yml with PostgreSQL."This single prompt generates the entire backend structure: project config, custom user model, three Django apps, Docker setup, and dependency management. AI knows the Django best practices (custom user model from day one, apps directory, environment-based settings) because it has seen thousands of Django projects.
Git setup: the foundation
Before writing any code, set up git. This is non-negotiable. AI will be making many changes, and you need the ability to review them, revert mistakes, and track what changed when.
claude "Initialize git for this project.
Create a comprehensive .gitignore for:
- Python (venv, __pycache__, .env)
- Node.js (node_modules, .next)
- IDE files (.vscode, .idea)
- OS files (.DS_Store)
Make the initial commit with all scaffolded files."After AI makes changes, always check the git diff before moving on. Run 'git diff' or use your IDE's diff viewer. This is your safety net. If AI generated something wrong, you catch it early. Think of it as a code review — except the junior developer is an AI.
The 80/20 rule of AI scaffolding
AI will get the structure right, but the details will need tweaking. For PraktickAI, AI correctly set up the Django project with all three apps, but the initial settings.py needed adjustments: the ALLOWED_HOSTS was too permissive, the database config did not use environment variables properly, and CORS was not configured.
This is normal. Do not fight it. Review what AI generated, note what needs fixing, and tell AI to fix it. The iterative loop of 'generate, review, refine' is the core workflow of building with AI.
claude "Review the Django settings.py you just created.
Fix these issues:
1. Use django-environ for ALL config (DATABASE_URL, SECRET_KEY, DEBUG)
2. ALLOWED_HOSTS should come from env var, not be hardcoded
3. Add CORS configuration with django-cors-headers
4. Add CSRF_TRUSTED_ORIGINS
5. SECRET_KEY must crash on startup if not set in production"Local development environment
For PraktickAI, the local dev setup is simple: PostgreSQL runs in Docker, Django runs natively with uv, and Next.js runs with npm. AI set this up in one prompt.
# Start the database
docker compose up -d db
# Backend (in one terminal)
uv run python manage.py migrate
uv run python manage.py runserver 0.0.0.0:8008
# Frontend (in another terminal)
npm install
npm run devThe key is to verify everything works immediately. Do not move on to building features until the scaffolding is solid: the frontend loads, the backend responds, the database accepts connections, and migrations run cleanly.
Build and run your project after EVERY significant change. This is the most important habit you can develop. AI-generated code that has never been executed is untrusted code. The build step is your first line of defense.
AI writes your initial models
Once the scaffolding works, let AI create your initial data models. Describe your data in plain English and AI will translate it to Django models with proper fields, relationships, and indexes.
claude "Create Django models for the courses app:
- Course: slug (unique), difficulty (beginner/intermediate/advanced),
estimated_hours, price_czk (nullable, null=free), price_eur (nullable),
is_published, created/updated timestamps
- Lesson: belongs to a Course, slug (unique within course),
order (integer), is_free_preview (boolean)
- Enrollment: links User to Course, enrolled_at timestamp,
unique together on user+course
Create and run the migration."Choose either a frontend or backend project and have AI scaffold it from scratch. Use one of these prompts: For a Next.js frontend: claude "Create a Next.js project with TypeScript, Tailwind CSS, and ESLint. Set up a clean directory structure with src/ and a basic home page." For a Django backend: claude "Create a Django project with uv, django-environ for settings, and a custom User model. Include a Dockerfile and docker-compose.yml with PostgreSQL." After AI finishes, run the project and verify it works. Check the git diff to see everything AI created.
Hint
If something does not work on first run, do not fix it manually. Tell AI what the error is and let it fix it. This builds the habit of using AI as your primary tool, not just a helper.
After scaffolding your project, review the generated code for these common issues: 1. Are secrets hardcoded? (SECRET_KEY, database passwords) 2. Is the .gitignore comprehensive? 3. Are environment variables used for configuration? 4. Does the Dockerfile follow best practices? (multi-stage build, non-root user) For each issue you find, tell AI to fix it with a specific instruction. Track how many iterations it takes to get a clean setup.
Hint
AI commonly hardcodes SECRET_KEY in settings.py for convenience. This is fine for local dev but dangerous in production. Make sure all secrets come from environment variables.
After scaffolding your project, customize the development environment with AI help: 1. Ask AI to add a pre-commit hook that runs linting and formatting 2. Ask AI to create a docker-compose.yml for local development (app + database) 3. Ask AI to add a Makefile (or just scripts in package.json) with common commands: dev, test, lint, build 4. Ask AI to set up environment variables with a .env.example file 5. Test everything: run dev server, run tests, run linter Verify: can a new developer clone the repo and start working in under 5 minutes?
Hint
The mark of a well-set-up project is that 'git clone && make dev' gets you a working development environment. AI is excellent at generating boilerplate configuration — let it handle the tedious parts while you verify correctness.
- AI excels at scaffolding — project setup takes minutes, not hours
- Be specific about your preferences (TypeScript vs JS, uv vs poetry) or AI will choose for you
- The 80/20 rule: AI gets the structure right, you refine the details
- Always verify the scaffolding works (build, run, connect) before moving on
- Git is non-negotiable — you need to track, review, and revert AI changes
- Build after every change — untested AI code is untrusted code
In the next lesson, we dive into Building the Frontend — a technique that gives you a clear edge. Unlock the full course and continue now.
2/12 complete — keep going!