This is a Next.js (TypeScript) app for displaying police scanner alerts from a PostgreSQL database and playing audio from AWS S3 using presigned URLs.
- Fetches recent alerts from a PostgreSQL database.
- Displays alerts in a modern, responsive interface.
- Plays audio from S3 using presigned URLs.
- Browser notifications for new alerts.
- Timestamps displayed in the user's local time zone.
- Redirects from old domains using middleware.
- Next.js - React framework
- TypeScript - Typed JavaScript
- PostgreSQL - Database
- AWS S3 - Audio storage
- Luxon - Date and time library
app/page.tsx— Main UI componentcomponents/— Reusable React componentslib/— Utility functions (API, date, notifications, etc.)middleware.ts— Handles redirectspublic/— Static assetsstyles/— Global CSS styles
-
Install dependencies:
npm install
-
Set up environment variables:
Copy
.env.local.exampleto.env.localand fill in your credentials:DATABASE_URL=... AWS_REGION=... S3_BUCKET=... -
Run the development server:
npm run dev
Open http://localhost:3000 to see the app.
This app is optimized for deployment on platforms like Vercel, Netlify, or AWS Amplify. The middleware.ts file handles redirects from old domains to the new one.