• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
ahmed33

ahmed33

my-first-val54

Public
Like
my-first-val54
Home
Code
7
backend
2
frontend
2
01_script.tsx
H
02_http.tsx
C
03_cron.tsx
E
04_email.tsx
README.md
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
6/2/2025
README.md

Job Board & Chat API 🚀

A REST API built with Hono that provides job listing management and a public chat room functionality.

Features

  • Job Listings API: Post and retrieve job listings
  • Public Chat: Real-time chat room for public discussions
  • Web Interface: Simple frontend to interact with the API
  • SQLite Storage: Persistent data storage using Val Town's SQLite

Project Structure

├── backend/
│   ├── index.ts              # Main API server (HTTP endpoint)
│   └── database/
│       ├── migrations.ts     # Database schema definitions
│       └── queries.ts        # Database query functions
├── frontend/
│   ├── index.html           # Web interface
│   └── app.js               # Frontend JavaScript
└── README.md

API Endpoints

Job Listings

  • POST /api/jobs - Create a new job listing

    { "title": "Software Engineer", "company": "Tech Corp", "description": "We're looking for...", "location": "Remote", // optional "salary": "$80k-120k", // optional "contactEmail": "hr@techcorp.com" }
  • GET /api/jobs - Get all job listings

  • GET /api/jobs/:id - Get a specific job by ID

Public Chat

  • POST /api/chat - Post a message to the chat

    { "username": "john_doe", "message": "Hello everyone!" }
  • GET /api/chat - Get recent chat messages

    • Optional query parameter: ?limit=N (default: 50)

Documentation

  • GET /api - Get full API documentation with schemas

Usage

  1. Web Interface: Visit the main URL to use the interactive web interface
  2. API Access: Make HTTP requests to the endpoints listed above
  3. Testing: Use tools like curl, Postman, or the built-in web interface

Example API Calls

Post a Job

curl -X POST /api/jobs \ -H "Content-Type: application/json" \ -d '{ "title": "Frontend Developer", "company": "StartupXYZ", "description": "Looking for a React developer...", "location": "San Francisco", "salary": "$90k-130k", "contactEmail": "jobs@startupxyz.com" }'

Get All Jobs

curl /api/jobs

Post a Chat Message

curl -X POST /api/chat \ -H "Content-Type: application/json" \ -d '{ "username": "developer123", "message": "Anyone hiring React developers?" }'

Get Chat Messages

curl /api/chat?limit=20

Database Schema

Job Listings Table

  • id - Auto-incrementing primary key
  • title - Job title (required)
  • company - Company name (required)
  • description - Job description (required)
  • location - Job location (optional)
  • salary - Salary information (optional)
  • contact_email - Contact email (required)
  • created_at - Timestamp
  • updated_at - Timestamp

Chat Messages Table

  • id - Auto-incrementing primary key
  • username - Username (required, max 50 chars)
  • message - Message content (required, max 500 chars)
  • created_at - Timestamp

Development

The API is built using:

  • Hono - Fast web framework
  • SQLite - Database storage
  • TypeScript - Type safety
  • Val Town Utils - File serving utilities

Error Handling

The API returns appropriate HTTP status codes:

  • 200 - Success
  • 201 - Created
  • 400 - Bad Request (validation errors)
  • 404 - Not Found
  • 500 - Internal Server Error
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.