Skip to content

Latest commit

Β 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

sam β€” coding assistant

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 react vite license

Features

  • Terminal aesthetic β€” dark theme, JetBrains Mono, a boot sequence, blinking caret, and typing indicator.
  • Markdown-aware rendering β€” inline code and 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.

Quick start

git clone https://github.com/as7111771-create/sam-coding-assistant.git
cd sam-coding-assistant
npm install
npm run dev

Then open the URL Vite prints (usually http://localhost:5173).

⚠️ API key / CORS note

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:

  1. API key β€” you need a valid Anthropic API key. The current code does not send an x-api-key header, so you'll need to add one (or proxy the request through a backend) before it will return responses. Add the header to the fetch call in SamChat.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-...
    
  2. 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.

Project structure

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

Customization

  • System prompt β€” edit SYSTEM_PROMPT at the top of src/SamChat.jsx.
  • Suggestions β€” edit the SUGGESTIONS array.
  • Model β€” change model: "claude-sonnet-4-6" in the send() function.
  • Colors β€” tweak the CSS custom properties (.app block): --bg, --panel, --teal, --amber, etc.

License

MIT β€” free to use, modify, and distribute.

About

πŸ’» A sleek terminal-styled React coding assistant chat UI β€” Sam, a sharp, friendly AI coding assistant. Built with React, Vite, and Claude.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages