8000 GitHub - keyouss/atoms-lite: AI application builder demo with React, FastAPI, Neon PostgreSQL, and Sandpack. · GitHub
[go: up one dir, main page]

Skip to content

About

AI application builder demo with React, FastAPI, Neon PostgreSQL, and Sandpack.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Atoms Lite

An AI-native application builder demo: describe an app, generate React files, preview it interactively, request changes, and restore earlier versions.

  • Status — Workspace 2.0 has been tested locally with PostgreSQL and the configured model. The original deployment spike verified a local connection to Neon.
  • Live demo — Vercel verification is pending.
  • Source — keyouss/atoms-lite
  • Implementation notes — Atoms Lite 2.0 实现说明 covers design choices, verified features, and follow-up priorities.

Product

Atoms Lite demonstrates a compact application-building workflow:

Prompt → Plan → File operations → Sandpack → Modify → Restore or export

It is inspired by the interaction patterns of AI app builders. It is an independent demo and is not affiliated with Atoms, bolt.diy, Vercel, Neon, or CodeSandbox.

Technology

  • React + TypeScript + Vite
  • FastAPI on Vercel Python runtime
  • Neon PostgreSQL
  • Sandpack React preview
  • Server-side LLM provider adapter
  • SSE or polling for generation progress

Features

  • Anonymous sessions and per-session projects, stored in PostgreSQL.
  • Model-backed plans and follow-up edits. The tool activity records the file operations the server executed.
  • Hierarchical file tree and Monaco editor for TypeScript, TSX, CSS and JSON. Edits update Sandpack, and Ctrl+S or Cmd+S saves the compiled draft as a new version.
  • Sandpack compilation status, runtime diagnostics and console. Failed Agent candidates can trigger up to three targeted repairs before the saved project is left in place.
  • Append-only version history, Monaco Diff, and ZIP export of individual saved versions. The ZIP includes a standalone Vite React app and setup instructions.

The local verification status for each feature is tracked in docs/PLAN.md.

Local development

Run from the repository root with a supported Node.js version and the Python dependencies in pyproject.toml, including the dev extra. Local testing used Node.js 26 and Python 3.11.

Copy the keys from .env.example into .env. Set a PostgreSQL DATABASE_URL, APP_ENV=development, and a random SESSION_SECRET of at least 32 characters. Configure LLM_API_KEY, LLM_BASE_URL and LLM_MODEL for generation. Use the OpenAI-compatible base URL up to /v1, or its full /chat/completions endpoint. LLM_PROVIDER_NAME optionally sets the display label. Keep .env local.

npm --prefix frontend ci
npm --prefix frontend run build
python -B -m api.migrate
python -B -m unittest discover -s tests -v
python -B -m uvicorn api.index:app --host 127.0.0.1 --port 8765 --env-file .env

Open http://127.0.0.1:8765, create a project, and submit a prompt. The workspace uses the same-origin Python API. Open Diagnostics to inspect FastAPI and PostgreSQL readiness. /api/health/db executes SELECT 1 and returns HTTP 503 with a safe error if the probe fails.

Set ATOMS_TEST_DATABASE_URL in the test process to a PostgreSQL test connection with permission to create a schema. The suite creates and removes a randomly named schema and sets the search path inside each transaction, for both direct and pooled connections. With no test connection configured, the integration suite is skipped.

With the model settings also loaded in the test process, set ATOMS_RUN_LIVE_MODEL_TEST=1 for the live acceptance case. This calls the configured model to create and modify a counter through the SSE API, then verifies that reopening, session isolation, and append-only restore work against PostgreSQL.

Sandpack uses its hosted React TypeScript runtime. This runtime requires the browser to reach the configured Sandpack host. App storage stays in the browser. The platform stores projects, generated files, and history in PostgreSQL.

Deployment

The local build serves the React page and API on one origin. Cloud verification is pending.

  1. Select a GitHub repository and import it into Vercel using the repository root and FastAPI preset. vercel.json defines the frontend build command.
  2. Connect Neon in Vercel Marketplace, or add an existing Neon project's pooled DATABASE_URL to the Vercel environment being tested. Redeploy after setting it. Phase 0 needs no model credentials.
  3. Open the deployed page and check that both connection checks report Connected. Independently verify HTTP 200 from /api/health and /api/health/db.
  4. Use a streaming HTTP client on /api/health/stream and confirm that started and finished arrive separately, roughly 1.2 seconds apart. Record the deployed evidence and transport choice in docs/PLAN.md and docs/SPEC.md.
  5. Apply the Phase 0 deployment gate in docs/ACCEPTANCE.md. The remaining acceptance sections apply to later phases.

For the full builder, also initialize the deployment database with python -B -m api.migrate against the project's approved connection, set APP_ENV=production, and configure SESSION_SECRET, LLM_API_KEY, LLM_BASE_URL, and LLM_MODEL in the Vercel server environment. Run the same migration when upgrading a 1.x database to add the candidate table alongside existing projects and versions.

Do not mark deployment complete until the live app has been tested.

Architecture and decisions

See the implementation and acceptance records.

  • docs/RESEARCH.md
  • docs/PRD.md
  • docs/SPEC.md
  • docs/PLAN.md
  • docs/ACCEPTANCE.md
  • docs/ARCHITECTURE.md
  • docs/REFERENCE_IMPLEMENTATION.md
  • docs/FEATURE_GAP_ANALYSIS.md

References

About

AI application builder demo with React, FastAPI, Neon PostgreSQL, and Sandpack.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0