The Stack

What reusable modules look like — and why you should build them

Why Build Modules?

Once you’ve shipped a few projects, patterns emerge. You write the same notification logic, the same data-pulling code, the same scraping setup. Every time from scratch. That’s wasted work. Package common patterns into reusable modules. One import, any project. The second project that uses a module is where you start getting leverage. Your stack will look different based on what you’re solving for — the examples below are the pattern, not the prescription


The Case for Infrastructure

If AI can write code on the fly — why build anything reusable?

DimensionAI-Generated (per session)Packaged Module
StateGone when conversation endsPersistent credentials, connections
ErrorsAI decides whether to retryBackoff, logging, alerts
CompositionRe-derived every sessionSame interface every time
AutonomousNeeds active conversationCron jobs, background workers
TestableOutput varies by promptDeterministic, CI-friendly

How to Prompt Against Your Stack

Your stack gives your agents both a vocabulary and a set of imports. There are two ways to get leverage from it

ModeHow it worksPrompt shape
Name the railsYou already know your modules, so you speak in their names. The agent can stop guessing at architecture and operate on infrastructure you understandUpdate Olympus Echo to do X, then use Olympus Aegis to lock that feature behind academy access
Add intent hooksAs you build, give the system hooks that map plain-English intent to existing infrastructure. The agent hears what you want, checks what already exists, and reaches for the right module before writing new codeWhen I ask to notify the cohort, route through notifications. When I ask to lock a page, check auth groups. When I ask to run it every morning, create a scheduled job

Over time, the prompt changes. You stop asking for code in the abstract and start asking the system to use the layers you already have. Sometimes you name the layer directly. Sometimes you teach the stack enough intent that the agent can find it for you


Stand on the Shoulders of Giants

The most important architectural decision you'll make is what not to build. Don't reinvent the wheel


Example Modules

Each module is standalone — pip install and go. The pattern matters more than the naming

ModuleWhat it doesWhy you'd build it
NotificationsRoute messages to Slack, email, SMSEvery app needs to tell you when something happens
Data FeedsAdapters for external APIs (market data, weather, CRM)Normalize many sources into one interface
ScrapingExtract data from any websiteWrite the retry + rate-limit logic once
InferenceCall LLMs, TTS, image gen through one interfaceSwap providers without changing app code
SearchIndex content, keyword + semantic retrievalEvery app with data needs findability
AuthLogin, sessions, role-based accessShared across all your web apps
Import any module
from your_toolkit.notifications import send_alert
from your_toolkit.data import get_price
from your_toolkit.scraper import extract

End-to-End Example

Analyze AAPL, GOOGL, MSFT stocks and generate a deck. One pipeline. Data → analysis → report → deliver

The Pipeline

StepModuleWhat happens
1. Pull dataData FeedsFetch from 3 APIs, normalize into one format
2. AnalyzeYour app logicTransform, filter, calculate — this is where your domain expertise lives
3. Generate outputTemplates (Jinja2)Render HTML report or PowerPoint deck from the data
4. DeliverNotificationsEmail the deck, post to Slack, update a dashboard
What the code looks like # Step 1 — Pull data (your data feed module) data = await feeds.gather(["AAPL", "GOOGL", "MSFT"]) # Step 2 — Your analysis (this is your app, your domain) summary = analyze(data) # Step 3 — Generate report (Jinja2 template) html = render_template("report.html", summary=summary) # Step 4 — Deliver (your notification module) send_email(to="team@co.com", subject="Daily Report", html=html)

Four steps. Three modules. The analysis in Step 2 is where your thinking lives. Everything else is infrastructure that shouldn’t be rewritten every time


Deep Dive: Search

That pipeline used three simple modules. Some modules are complex enough to deserve their own deep dive — search is the most common. Almost every production app needs it, and the implementation choices compound across everything you build

PatternHow it worksWhen to use
Keyword (BM25)Match query tokens against indexed documentsStructured data, exact term matching, Postgres full-text search
Semantic (Vectors)Embed text into vectors, find nearest neighbors by cosine similarityNatural language queries, “find similar”, RAG pipelines
HybridRun both, merge and re-rank resultsProduction systems where you need both precision and recall
What a search module looks like
from your_toolkit.search import index, query

# Index your content once
index(documents, method="hybrid") # keyword + vector

# Query naturally
results = query("how do I deploy to production", top_k=5)

This is the same pattern behind every AI chatbot, knowledge base, and recommendation engine. Wrap the embedding model, vector store, and retrieval logic into one module. Your app just calls query()


Modules Compose into Applications

Search is one module. Combine it with data feeds, notifications, auth, and templates, and full applications start to feel assembled

ApplicationModules usedWhat it does
Market ReportData Feeds + Templates + NotificationsPulls market data, generates a deck, emails it to the team every morning
Outbound EngineScraping + NotificationsScrapes contacts from the web, enriches them, runs multi-channel outreach
Internal ToolAuth + Database + TemplatesConfigurable dashboards with login, persistent state, and role-based access
Knowledge BaseSearch + Inference + DatabaseIndex company docs, search semantically, answer questions with LLM + retrieved context (RAG)

Four applications, four different module combinations. The modules are interchangeable — swap data feeds for scraping, swap templates for a dashboard, and you have a different product built on the same infrastructure


What to Build

Those four are starting points. Here’s a broader set — each project exercises different layers and teaches different skills. Pick one that maps to a problem you actually have

Build ThisLayersWhat You Learn
Daily market report emailerData feeds + Jinja2 + SMTP + cronAPI adapters, HTML templating, scheduled jobs, email delivery
Internal dashboard with loginFlask + Postgres + Auth + DokkuCRUD, session management, role-based access, deployment
Outbound recruiting engineWeb scraping + enrichment + email sequencesRate limiting, data normalization, multi-step pipelines
Knowledge base chatbot (RAG)Embeddings + pgvector + LLM + FastAPIChunking, vector search, prompt engineering, streaming
PDF report generatorpdfplumber + openpyxl + Jinja2 + click CLIFile parsing, data extraction, templated output, CLI design
Webhook-driven Slack botFlask + Slack SDK + background workersEvent-driven architecture, async processing, API integration
Automated video pipelineTTS API + moviepy + upload APIs + cronMedia processing, API orchestration, multi-platform distribution
Prediction market trading botMarket data feeds + strategy engine + risk mgmt + PostgresReal-time data, state machines, financial logic, observability
People search systemPostgres + pgvector + NL parser + FlaskSchema design, hybrid search, hard/soft constraint ranking
CI/CD pipeline from scratchGitHub Actions + Docker + nginx + Let's EncryptContainers, automated testing, zero-downtime deploys, SSL

The specific tools matter less than the pattern. Every system is a composition of the same layers: data in, logic applied, output delivered. Level Up teaches the vocabulary. Building these teaches the muscle memory

Haven't read the foundation yet?

Level Up →