Build Your First End-to-End AI App
The single fastest way to go from "AI student" to "AI engineer" is to ship something live on the internet. Not a notebook. Not a Streamlit demo on your laptop. A real URL that strangers can hit, with metrics in a dashboard somewhere. This lesson walks you through building, deploying, and sharing exactly that — in one weekend.
After this lesson, you will be able to:
- Pick a project idea that solves a real problem instead of chasing impressive-sounding tech
- Build an MVP using ~80 lines of Python + FastAPI + Claude API, with proper error handling and config
- Deploy to a real internet URL using Railway or Vercel and verify it works from a phone
- Share the project on LinkedIn / Twitter / Hacker News in a way that triggers actual conversations, not crickets
Before you start
#Step 1: Pick a Real Problem (Not Impressive Tech)
The biggest mistake new builders make is choosing projects by how impressive the tech sounds. "I'll fine-tune a 70B model and deploy it on Kubernetes." Six months later: nothing shipped.
The right framing is the opposite. Pick a problem so small and so concrete that you can finish a v1 in a weekend. The tech is secondary.
#The "Friend Problem" Test
Walk through your week. Identify one thing a friend, family member, or coworker complains about repeatedly. That's your project.
Worked examples of the pattern — each one starts from a specific annoyance a real person had, which is the part that matters:
| Project | Problem | Tech used | Build time |
|---|---|---|---|
| PaperSorter | Friend in grad school had 400 unread arxiv papers | Embeddings + Claude API + CLI | 6 hrs |
| SlackSummarizer | Coworker missed long Slack threads while on PTO | Slack API + Claude API + cron | 8 hrs |
| VoiceTranslator | Telegram bot for parents who only speak Tamil | Whisper API + Claude + Telegram bot | 10 hrs |
| MeetingActionItems | Manager wanted action items extracted from Zoom transcripts | Zoom transcript + Claude + Notion API | 12 hrs |
| RecipeFromFridge | Roommate asked "what can I cook?" looking at the fridge | Image + Claude vision + recipes | 8 hrs |
Notice: none of these required novel research. All required taste — picking a real problem, building a clean MVP, measuring whether it actually helped.
#Anti-patterns to avoid
- "AI for X" with no X user in sight. Pick a real user, even if that user is just you.
- Reinventing GPT. Don't try to train a foundation model.
- The mega-project. "I'll build a full ChatGPT clone with auth, payments, multi-modal, agents…" Ship the smallest possible version. Add features only after v1 is in use.
- The leaderboard chase. Beating SOTA on MNIST by a fraction of a percent won't help you get a job in 2026. Shipping a useful tool will.
#Step 2: Scope The MVP (Build → Deploy → Measure → Iterate)
The MVP cycle has four stages. Most beginners only do "build." That's why they never ship.
- Build (Day 1): Smallest possible thing that solves the problem end-to-end.
- Deploy (Day 1, same day): Get it on a real URL. Do not skip.
- Measure (Day 2): Add logging. Run the eval. Get one real user trying it.
- Iterate (Days 3-5): Fix the obvious issues. Add one feature at a time.
Notice: deploy is on Day 1. Not Day 14. The reason: deployment is where things break. Configs, environment variables, dependency mismatches, port issues. Fix all of that on Day 1, when the codebase is small, not Day 14, when it's tangled.
#Step 3: A Complete Working Example
This is intentionally a common project type. Hiring managers see hundreds of RAG demos. What separates yours: clean code, real evals, public deployment, written-up methodology.
#Project structure
askmypdf/
├── main.py # FastAPI app (~80 lines)
├── rag.py # Embedding + retrieval logic (~50 lines)
├── eval.py # Evaluation script (~30 lines)
├── requirements.txt
├── .env.example
├── README.md # The single most important file
└── tests/
└── test_rag.py
#The complete backend: main.py (~80 lines)
# Copy to Colab or run on your own machine: needs an API key and network access, so it cannot run on this page.
"""
AskMyPDF — a minimal RAG app over a single PDF.
Endpoints:
POST /upload — upload a PDF, return a doc_id
POST /ask — ask a question about an uploaded doc
Run locally: uvicorn main:app --reload
"""
import os
import uuid
from typing import Annotated
from fastapi import FastAPI, File, UploadFile, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from pydantic import BaseModel
from pypdf import PdfReader
from anthropic import Anthropic
from rag import build_index, retrieve
# ----- config -----
ANTHROPIC_API_KEY = os.environ["ANTHROPIC_API_KEY"]
MODEL = "claude-opus-4-5"
MAX_PDF_PAGES = 200
# ----- app -----
app = FastAPI(title="AskMyPDF")
app.add_middleware(
CORSMiddleware, allow_origins=["*"], allow_methods=["*"], allow_headers=["*"]
)
client = Anthropic(api_key=ANTHROPIC_API_KEY)
INDEX: dict[str, dict] = {} # in-memory; swap for Postgres in v2
class AskRequest(BaseModel):
doc_id: str
question: str
@app.get("/")
def health() -> dict:
return {"status": "ok", "docs_indexed": len(INDEX)}
@app.post("/upload")
async def upload_pdf(file: Annotated[UploadFile, File()]) -> dict:
if not file.filename or not file.filename.lower().endswith(".pdf"):
raise HTTPException(400, "Please upload a .pdf file.")
reader = PdfReader(file.file)
if len(reader.pages) > MAX_PDF_PAGES:
raise HTTPException(400, f"PDF too long (max {MAX_PDF_PAGES} pages).")
text = "\n".join(page.extract_text() or "" for page in reader.pages)
if not text.strip():
raise HTTPException(400, "Could not extract any text from PDF.")
doc_id = str(uuid.uuid4())[:8]
INDEX[doc_id] = build_index(text)
return {"doc_id": doc_id, "pages": len(reader.pages), "chunks": len(INDEX[doc_id]["chunks"])}
@app.post("/ask")
def ask_question(req: AskRequest) -> dict:
if req.doc_id not in INDEX:
raise HTTPException(404, f"Unknown doc_id {req.doc_id}")
if not req.question.strip():
raise HTTPException(400, "Question cannot be empty.")
relevant = retrieve(INDEX[req.doc_id], req.question, k=4)
context = "\n\n---\n\n".join(relevant)
prompt = (
"You are a careful assistant answering questions strictly from the provided "
"document excerpts. If the answer is not in the excerpts, say 'I cannot find "
"that in the document.'\n\n"
f"=== Document excerpts ===\n{context}\n\n"
f"=== Question ===\n{req.question}\n\n"
"Answer concisely (2-4 sentences), citing the excerpt number when you use it."
)
response = client.messages.create(
model=MODEL,
max_tokens=512,
messages=[{"role": "user", "content": prompt}],
)
return {
"answer": response.content[0].text,
"chunks_used": len(relevant),
"tokens_in": response.usage.input_tokens,
"tokens_out": response.usage.output_tokens,
}#The retrieval module: rag.py (~50 lines)
"""
Minimal in-memory RAG: chunk + embed + cosine-similarity retrieval.
For a 1-200-page PDF, this is plenty. Swap for pgvector once you outgrow it.
"""
import re
import numpy as np
from sentence_transformers import SentenceTransformer
_model = SentenceTransformer("BAAI/bge-small-en-v1.5")
CHUNK_SIZE = 600 # chars
CHUNK_OVERLAP = 80
def _chunk(text: str) -> list[str]:
text = re.sub(r"\s+", " ", text).strip()
chunks = []
i = 0
while i < len(text):
chunks.append(text[i : i + CHUNK_SIZE])
i += CHUNK_SIZE - CHUNK_OVERLAP
return chunks
def build_index(text: str) -> dict:
chunks = _chunk(text)
embeddings = _model.encode(chunks, normalize_embeddings=True)
return {"chunks": chunks, "embeddings": np.array(embeddings)}
def retrieve(index: dict, query: str, k: int = 4) -> list[str]:
q_emb = _model.encode([query], normalize_embeddings=True)[0]
scores = index["embeddings"] @ q_emb
top_k_idx = np.argsort(scores)[::-1][:k]
return [index["chunks"][i] for i in top_k_idx]#The eval script: eval.py (~30 lines)
This is what separates a portfolio project from a course project. Measure something.
"""
Eval harness: run 20 questions against a known doc, count correct answers.
Usage: python eval.py path/to/doc.pdf path/to/qa_pairs.json
"""
import json
import sys
import requests
BASE_URL = "http://localhost:8000"
def main(pdf_path: str, qa_path: str) -> None:
with open(pdf_path, "rb") as f:
upload = requests.post(f"{BASE_URL}/upload", files={"file": f}).json()
doc_id = upload["doc_id"]
qa_pairs = json.load(open(qa_path))
correct = 0
for i, qa in enumerate(qa_pairs, 1):
resp = requests.post(
f"{BASE_URL}/ask",
json={"doc_id": doc_id, "question": qa["question"]},
).json()
# Simple substring match against expected answer keywords.
# Better: use an LLM-as-judge for fuzzy matching.
match = all(kw.lower() in resp["answer"].lower() for kw in qa["expected_keywords"])
correct += match
print(f"[{i}] {'PASS' if match else 'FAIL'} — {qa['question'][:60]}")
print(f"\nAccuracy: {correct}/{len(qa_pairs)} = {100 * correct / len(qa_pairs):.0f}%")
if __name__ == "__main__":
main(sys.argv[1], sys.argv[2])That's about 160 total lines including the eval. Less than one chapter of a textbook. But it is a complete, evaluable, deployable system.
#Step 4: Deploy to Railway (or Vercel)
Railway is the fastest way to get a Python+FastAPI app online. Here's the exact sequence.
# Copy to Colab or run on your own machine: needs an API key and network access, so it cannot run on this page.
# 1) Make sure your app runs locally
uvicorn main:app --reload
# Visit http://localhost:8000 and confirm health endpoint returns 200.
# 2) Add a Procfile (Railway reads this)
echo "web: uvicorn main:app --host 0.0.0.0 --port \$PORT" > Procfile
# 3) Push to GitHub
git init
git add .
git commit -m "Initial commit: AskMyPDF v1"
git remote add origin https://github.com/<you>/askmypdf
git push -u origin main
# 4) Install Railway CLI
brew install railway # or: npm install -g @railway/cli
# 5) Deploy
railway login
railway init # links this dir to a new Railway project
railway up # deploys
# 6) Set your env var
railway variables set ANTHROPIC_API_KEY=sk-ant-...
# 7) Get your public URL
railway domain
# Outputs something like: https://askmypdf-production.up.railway.app
{"status": "ok"}, you have officially shipped a live AI app on the internet.git init to live URL: often under an hour for a small app like this, once your accounts are set up.#Cost reality check
Hosting: free tiers on platforms like Railway or Vercel often cover a small hobby app, and paid plans start low. Plans and limits change, so check the platform's pricing page (as of October 2026, verify).
LLM API: each question costs a small amount, and input tokens (the retrieved chunks) usually dominate. Work out your own cost per question from the provider's current price list and your measured token counts. Set a usage limit on your API dashboard so a viral moment doesn't bankrupt you.
For a small project the total running cost while you job hunt is usually modest. Track it so you can quote a real number in your README.
#Step 5: The README That Sells The Project
Your README is the second thing people see after the live URL. Treat it like the resume bullet for the project, but with room to breathe.
A README that converts:
# AskMyPDF
> Upload a PDF. Ask questions. Get answers grounded in the document.
**Live demo:** https://askmypdf-production.up.railway.app
**60-second Loom:** https://loom.com/share/xxxxx
## What it does
Upload a PDF (up to 200 pages). The app chunks it, embeds it with BGE-small,
indexes it in-memory, and answers your questions using Claude — citing the
exact excerpts it used. If the answer isn't in the document, it says so
instead of hallucinating.
## Why it exists
I built this for my partner, who works in policy and reads 30+ government
reports per week. She wanted a "Ctrl-F that understands meaning."
## Metrics
(Template note: every number in this README, including 64%, 89%, 1.2s and the costs, is a placeholder that shows the format. Replace each with your own measurement.)
Evaluated on a hand-labeled 50-question test set over 3 different PDFs
(a textbook, a legal contract, and a scientific paper):
| | Accuracy | p95 Latency | Cost/question |
|----------------|----------|-------------|---------------|
| Naive baseline | 64% | 1.2s | $0.011 |
| AskMyPDF v1 | 89% | 1.6s | $0.013 |
## How it works (one paragraph)
PDF text is chunked into 600-char windows with 80-char overlap, embedded
with `BAAI/bge-small-en-v1.5`, and stored as normalized NumPy vectors. At
query time we embed the question, take top-4 by cosine similarity, and
pass the chunks + question to Claude with a strict "answer only from the
excerpts" system prompt.
## Run locally
pip install -r requirements.txt
export ANTHROPIC_API_KEY=sk-ant-...
uvicorn main:app --reload
## What I'd build next
- Persistent storage (Postgres + pgvector) — currently in-memory
- LLM-as-judge eval instead of keyword matching
- Streaming responses
- Multi-PDF corpus
#Step 6: Sharing: Where and How
Building it is half the work. Shipping the share is the other half. Here's the playbook.
#LinkedIn post (highest job-search ROI)
Post 24-48 hours after deployment, while you're still excited. Format:
I just shipped my first end-to-end AI app: AskMyPDF.
The problem: my partner reads 30+ policy reports per week and asked for a "Ctrl-F that understands meaning."
v1 (deployed at [URL]) chunks a PDF, embeds with BGE-small, retrieves the top-4 chunks, and lets Claude answer, strictly from the document. On my 50-question eval set: [your accuracy] vs. [your baseline's accuracy] for a naive baseline.
A few things I learned: [1-3 specific technical lessons].
Code on GitHub: [link]. Try the demo here: [link]. Feedback welcome.
A post like this can start useful conversations, but do not count on a particular response.
#Twitter / X
Shorter version of the same post, with a screenshot or 30-second video. Tag the model provider (e.g., @AnthropicAI). Some posts get reposted by the official accounts, which drives serious traffic.
#Hacker News (Show HN)
Show HN: AskMyPDF – a minimal RAG over a single PDF. The HN community is harsh but if 5 people upvote and 2 leave critique, you've gotten more product feedback than most paying products ever do.#Direct outreach (highest hit rate)
DM 5 engineers you respect at companies you'd want to work at. Template:
Hi [Name], I built this small project ([link]) that solves [problem]. Given your work on [their thing], curious whether you'd see any obvious holes in the design. Either way, your work has been a useful reference — thank you.
About 1 in 3 reply. About 1 in 10 leads to a substantive conversation. Several lead to job referrals.
#Screenshot Specifications
When you share the project, include 2-3 screenshots. Aim for these:
- Hero shot: the landing page with the upload widget and a placeholder question.
- In-action: an actual question being answered, with cited chunks visible.
- README/metrics page: the table of evaluation results.
Use a tool like CleanShot X or Shottr for crisp screenshots. Keep them at 16:9 ratio for LinkedIn. Don't use stock images. Show the real product.
#Quick Check
When should you deploy your first AI project to a public URL?
Key takeaways
- Pick a friend problem, not impressive tech. Real users keep you motivated and produce better products.
- Ship the MVP on Day 1 to a real URL. Use Railway or Vercel; a small app can often be live in under an hour.
- Measure. Add an eval script with a held-out test set and a baseline. Put the metrics in the README.
- Your README is the second-most-important file in the repo. Lead with the demo, the why, and the numbers.
- Share intentionally on LinkedIn, Twitter, Hacker News, and direct DMs. The share is half the work — without it, the project is invisible.