Day 01 Foundations

Project Setup and Your First Chat Response

You will build a working AI chatbot from scratch over 5 days. Day 1 covers the project structure, Node.js setup, and getting your first response from the C

~1 hour Hands-on Precision AI Academy

Today's Objective

Learn the core concepts of Project Setup and Your First Chat Response and apply them in practical exercises.

01

What You Are Building

By the end of this course you will have a full-stack AI chatbot: a Node.js backend that calls the Claude API, a clean chat UI in the browser, RAG (retrieval-augmented generation) to answer questions from your own documents, and a deployed URL you can share. Every day produces working code.

02

Prerequisites

03

Project Structure

Terminal
Terminal
mkdir my-chatbot && cd my-chatbot
npm init -y
npm install express @anthropic-ai/sdk dotenv cors
touch .env server.js index.html
.env
.env
ANTHROPIC_API_KEY=your_api_key_here
04

First API Call

server.js
server.js
const express = require('express');
const Anthropic = require('@anthropic-ai/sdk');
const cors = require('cors');
require('dotenv').config();

const app = express();
const client = new Anthropic();

app.use(express.json());
app.use(cors());
app.use(express.static('.'));

app.post('/chat', async (req, res) => {
  const { message } = req.body;
  
  const response = await client.messages.create({
    model: 'claude-opus-4-5',
    max_tokens: 1024,
    messages: [{ role: 'user', content: message }]
  });

  res.json({ reply: response.content[0].text });
});

app.listen(3000, () => {
  console.log('Server running on http://localhost:3000');
});
Terminal — Test It
Terminal — Test It
node server.js

# In another terminal:
curl -X POST http://localhost:3000/chat   -H "Content-Type: application/json"   -d '{"message": "Hello! What can you help me with?"}'
💡
If you get an auth error: Check that your .env file has the correct API key and that it does not have extra spaces. The key starts with sk-ant-.

Supporting References & Reading

Go deeper with these external resources.

Anthropic Docs
Project Setup and Your First Chat Response Official Claude API documentation and guides.
YouTube
Project Setup and Your First Chat Response AI chatbot tutorials
MDN
MDN Web Docs Comprehensive web technology reference

Day 1 Checkpoint

Before moving on, confirm understanding of these key concepts:

Continue To Day 2
Day 2 of the Build an AI Chatbot course