A sleek, terminal-styled React coding assistant chat UI. Sam is a sharp, friendly coding assistant powered by Claude β drop in an error, a function, or an architecture question and get a tight, senior-engineer-caliber answer.
- Terminal aesthetic β dark theme, JetBrains Mono, a boot sequence, blinking caret, and typing indicator.
- Markdown-aware rendering β inline
codeand fenced code blocks with language labels and one-click copy. - Suggestion chips β quick-start prompts on the empty state.
- Auto-growing textarea β Enter to send, Shift+Enter for newline.
- Reduced-motion support β respects
prefers-reduced-motion.
git clone https://github.com/as7111771-create/sam-coding-assistant.git
cd sam-coding-assistant
npm install
npm run devThen open the URL Vite prints (usually http://localhost:5173).
The component calls the Anthropic Messages API directly from the browser:
https://api.anthropic.com/v1/messages
This is fine for local experimentation, but two things to be aware of:
-
API key β you need a valid Anthropic API key. The current code does not send an
x-api-keyheader, so you'll need to add one (or proxy the request through a backend) before it will return responses. Add the header to thefetchcall inSamChat.jsx:headers: { "Content-Type": "application/json", "x-api-key": import.meta.env.VITE_ANTHROPIC_API_KEY, "anthropic-version": "2023-06-01", },
Then create a
.env.local:VITE_ANTHROPIC_API_KEY=sk-ant-... -
CORS β Anthropic's API does not allow direct browser calls by default. For production, proxy the request through your own backend or serverless function. The direct-fetch approach is intended for local development only.
sam-coding-assistant/
βββ index.html # HTML entry
βββ package.json
βββ vite.config.js
βββ src/
β βββ main.jsx # React mount
β βββ SamChat.jsx # The full chat component + styles
βββ README.md
- System prompt β edit
SYSTEM_PROMPTat the top ofsrc/SamChat.jsx. - Suggestions β edit the
SUGGESTIONSarray. - Model β change
model: "claude-sonnet-4-6"in thesend()function. - Colors β tweak the CSS custom properties (
.appblock):--bg,--panel,--teal,--amber, etc.
MIT β free to use, modify, and distribute.