CrimeMap
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
index.ts
https://realcoder--cfe500563f9011f0905d76b3cceeab13.web.val.run
A web application that allows users to report crimes in their local area using an interactive map.
- Interactive map interface for selecting crime location
- Crime type categorization
- Anonymous reporting option
- Real-time crime report viewing
- Location-based crime filtering
├── backend/
│ ├── database/
│ │ ├── migrations.ts # Database schema setup
│ │ └── queries.ts # Database query functions
│ ├── routes/
│ │ ├── reports.ts # Crime report API endpoints
│ │ └── static.ts # Static file serving
│ └── index.ts # Main Hono server
├── frontend/
│ ├── components/
│ │ ├── App.tsx # Main React component
│ │ ├── CrimeMap.tsx # Interactive map component
│ │ └── ReportForm.tsx # Crime reporting form
│ ├── index.html # Main HTML template
│ ├── index.tsx # Frontend entry point
│ └── style.css # Custom styles
├── shared/
│ └── types.ts # Shared TypeScript types
└── README.md
- Backend: Hono (TypeScript API framework)
- Database: SQLite
- Frontend: React with TypeScript
- Map: Leaflet.js
- Styling: TailwindCSS
GET /api/reports
- Get all crime reports (with optional location filtering)POST /api/reports
- Submit a new crime reportGET /api/reports/stats
- Get crime statistics by type and area
id
- Primary keycrime_type
- Type of crime reporteddescription
- Detailed descriptionlatitude
- Location latitudelongitude
- Location longitudeaddress
- Human-readable addressreporter_name
- Reporter name (optional for anonymous reports)reporter_contact
- Contact information (optional)is_anonymous
- Boolean flag for anonymous reportsstatus
- Report status (pending, reviewed, resolved)created_at
- Timestamp of report creation
- Open the application in your browser
- Click on the map to select the crime location
- Fill out the crime report form
- Submit the report
- View existing reports on the map
The app automatically serves static files and provides a REST API for crime reports. The database is initialized on first run.