Skip to content

michaelcolenso/1033-Program-Map

Repository files navigation

1033 Program Map

An interactive map visualizing the US Department of Defense 1033 Program, which tracks the transfer of excess military equipment to law enforcement agencies across the United States.

What is the 1033 Program?

From Wikipedia:

The 1033 Program was created by the National Defense Authorization Act of Fiscal Year 1997 as part of the US Government's Defense Logistics Agency Disposition Services (DLA) to transfer excess military equipment to law enforcement agencies. As of 2014, 8,000 local law enforcement agencies participated in the reutilization program that has transferred $5.1 billion in military hardware from the Department of Defense to local American law enforcement agencies since 1997.

Features

  • Interactive map showing military equipment distribution across US counties
  • Real-time data updates using Socket.io
  • Color-coded visualization by cost per household
  • Detailed equipment breakdown by clicking on any county
  • User authentication (optional)
  • Responsive design for mobile and desktop

Tech Stack

  • Backend: Node.js 20+, Express.js 4
  • Database: MongoDB 6+ with Mongoose ODM
  • Real-time: Socket.io 4
  • Template Engine: Pug
  • Maps: Leaflet.js with D3.js overlay
  • Data: TopoJSON for county boundaries
  • Security: Helmet, rate limiting, CSRF protection

Quick Start

Using Docker (Recommended)

# Clone the repository
git clone https://github.com/michaelcolenso/1033-Program-Map.git
cd 1033-Program-Map

# Start with Docker Compose (database is seeded automatically)
docker-compose up -d

The application will be available at http://localhost:8080

To force a reseed of the database:

docker-compose run --rm seed-force

Manual Installation

Prerequisites

  • Node.js 20+
  • npm 10+
  • MongoDB 6+

Steps

  1. Clone and install

    git clone https://github.com/michaelcolenso/1033-Program-Map.git
    cd 1033-Program-Map
    npm install
  2. Configure environment

    cp .env.example .env
    # Edit .env with your settings
  3. Start MongoDB

    # macOS
    brew services start mongodb-community
    
    # Ubuntu/Debian
    sudo systemctl start mongod
  4. Seed the database

    npm run seed
  5. Start the server

    # Development (with auto-reload)
    npm run dev
    
    # Production
    npm start

Environment Variables

Variable Description Default
NODE_ENV Environment mode development
PORT Server port 8080
MONGODB_URI MongoDB connection string mongodb://localhost:27017/1033-program-map
SESSION_SECRET Session encryption secret (required)
EMAIL_HOST SMTP host for password reset (optional)
EMAIL_USER SMTP username (optional)
EMAIL_PASSWORD SMTP password (optional)

Project Structure

1033-Program-Map/
├── app.js                 # Express application
├── routes/
│   └── index.js           # Route definitions
├── controllers/
│   ├── home.js            # Home page
│   ├── map.js             # Map page
│   ├── user.js            # Authentication
│   └── contact.js         # Contact form
├── models/
│   └── User.js            # User model
├── config/
│   ├── secrets.js         # Environment config
│   └── passport.js        # Auth strategies
├── views/                 # Pug templates
├── public/
│   ├── js/
│   │   ├── main.js        # Map logic
│   │   └── *.json         # GeoJSON data
│   └── css/
├── scripts/
│   └── seed.js            # Database seeder
├── Dockerfile
└── docker-compose.yml

Scripts

npm start          # Start production server
npm run dev        # Start development server with auto-reload
npm test           # Run test suite
npm run seed       # Seed database with equipment data
npm run seed:skip  # Seed only if collection is empty
npm run seed:force # Drop and reseed collection
npm run lint       # Run ESLint

API Endpoints

Endpoint Description
GET / Home page
GET /map Interactive map
GET /api/health Health check
GET /login Login page
GET /signup Registration page

Socket.io Events

Event Direction Description
getid Client → Server Request equipment data for a county
id Server → Client Equipment data response

Deployment

Docker

docker build -t 1033-program-map .
docker run -p 8080:8080 -e MONGODB_URI=your-mongo-uri 1033-program-map

Render (Free) + MongoDB Atlas (Free)

  1. Create a free MongoDB Atlas cluster (M0) and database user.
  2. In Atlas Network Access, allow 0.0.0.0/0 (or tighter CIDR if available).
  3. Copy your Atlas connection string and replace <password>.
  4. Push this repository to GitHub (includes render.yaml Blueprint config).
  5. In Render, click New -> Blueprint and select this repo.
  6. Set MONGODB_URI in Render to your Atlas connection string.
  7. Deploy.

Render will run npm run seed:skip during deploy, so the first deploy seeds data and later deploys skip if data already exists.

To force reseed later from Render Shell:

npm run seed:force

Security

  • CSRF protection enabled
  • Rate limiting on API routes
  • Helmet.js security headers
  • Secure session cookies in production
  • Password hashing with bcrypt

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Data Source

Equipment data from The New York Times.

License

MIT

Support

For issues and questions, please open an issue on GitHub.

About

Map and Vis of the 1033 Program

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 44