Skip to content

Repository files navigation

Devscale AI Product Engineering — Batch 1

This repository contains the full-stack AI agent project for Devscale AI Product Engineering Batch 1. It is organized as a pnpm monorepo with a React chat interface, a Hono API, a reusable agent package, and PostgreSQL-backed conversation memory.

Tech stack

  • Platform: React 19, Vite, TanStack Router, Tailwind CSS
  • API: Hono and Node.js
  • Agent: Anvia, an OpenAI-compatible model provider, and Tavily web search
  • Database: PostgreSQL 16 and Prisma
  • Observability: Langfuse
  • Workspace: pnpm

Project structure

.
├── apps
│   ├── api          # Hono API and Prisma schema
│   └── platform     # React chat application
├── packages
│   └── agent        # Agent, model, tools, prompts, and tracing
├── docker-compose.yml
└── pnpm-workspace.yaml

Prerequisites

Install the following before getting started:

  • Node.js 22 or newer
  • pnpm 11.9 or newer
  • Docker with Docker Compose
  • An API key for an OpenAI-compatible model provider
  • A Tavily API key
  • Langfuse credentials if tracing is enabled

Getting started

  1. Install the dependencies:

    pnpm install
  2. Create your local environment file:

    cp .env.example .env

    Update .env with your model provider and tool credentials. The configured model is currently deepseek-v4-flash; make sure the value of OPENAI_BASE_URL points to a compatible provider that offers this model, or update the model in packages/agent/src/providers/openai.ts.

  3. Start PostgreSQL:

    docker compose up -d db
  4. Generate the Prisma client and apply the database migrations:

    pnpm --filter api db:generate
    pnpm --filter api db:migrate
  5. Start the development servers:

    pnpm dev

The platform is available at http://localhost:3000, and the API runs at http://localhost:8000.

Environment variables

Variable Required Description
DATABASE_URL Yes PostgreSQL connection string used by Prisma and the API
OPENAI_API_KEY Yes API key for the configured OpenAI-compatible model provider
OPENAI_BASE_URL Provider-dependent Base URL for the OpenAI-compatible API
TAVILY_API_KEY Yes API key used by the agent's web search and extraction tools
LANGFUSE_BASE_URL For tracing Langfuse server or cloud URL
LANGFUSE_PUBLIC_KEY For tracing Langfuse project public key
LANGFUSE_SECRET_KEY For tracing Langfuse project secret key
NODE_ENV No Runtime environment, such as development

Never commit .env or real credentials. Use .env.example only as a reference.

Useful commands

# Run the platform and API in development mode
pnpm dev

# Run the agent directly with its development prompt
pnpm --filter @devscale/agent runner:dev

# Build the API and platform
pnpm --filter api build
pnpm --filter platform build

# Open Prisma Studio
pnpm --filter api db:studio

# Apply existing migrations in a deployment environment
pnpm --filter api db:deploy

API

The chat API is exposed at /api/chat:

  • GET /api/chat loads messages from the current development session.
  • POST /api/chat sends the latest user message to the agent and streams a JSONL response.

Learning goals

This project demonstrates how to build an AI product end to end: connecting a model to tools, streaming responses to a frontend, persisting agent memory, and tracing model activity for debugging and evaluation.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages