A full-stack application to scrape US government contracts from SAM.gov, store them in MongoDB, and provide a web interface for browsing and organizing contracts into lists.
- Backend: Node.js + Express
- Frontend: React + Tailwind CSS
- Database: MongoDB
- Scraper: Node.js with SAM.gov API integration
- Deployment: Docker
- Node.js 18+
- Docker and Docker Compose (for MongoDB)
- SAM.gov API key (free, register at https://sam.gov/content/entity-registration)
-
Start MongoDB using Docker:
docker-compose -f docker-compose.dev.yml up -d
-
Configure environment:
cd backend cp .env.example .env # Edit .env and add your SAM_API_KEY
-
Install and run backend:
cd backend npm install npm run dev -
Install and run frontend (in a new terminal):
cd frontend npm install npm run dev -
Open http://localhost:3000 in your browser
Run the scraper manually via CLI:
cd backend
npm run scrapeOr trigger it via API:
curl -X POST http://localhost:3001/api/scraper/runGET /api/contracts- List contracts (paginated, filterable)GET /api/contracts/:id- Get single contractGET /api/contracts/stats- Dashboard statistics
GET /api/lists- Get all listsPOST /api/lists- Create new listGET /api/lists/:id- Get list with contractsPUT /api/lists/:id- Update listDELETE /api/lists/:id- Delete listPOST /api/lists/:id/contracts- Add contract to listDELETE /api/lists/:id/contracts/:contractId- Remove from list
POST /api/scraper/run- Trigger scrapeGET /api/scraper/status- Check scraper status
Build and run with Docker Compose:
# Set your SAM API key
export SAM_API_KEY=your_api_key_here
# Build and start all services
docker-compose up -d --buildThe application will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
contracting/
├── backend/
│ ├── src/
│ │ ├── config/ # DB connection, env config
│ │ ├── models/ # MongoDB schemas
│ │ ├── routes/ # API endpoints
│ │ └── scraper/ # SAM.gov scraper
│ ├── server.js
│ └── Dockerfile
├── frontend/
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Main views
│ │ ├── hooks/ # Custom React hooks
│ │ └── services/ # API client
│ └── Dockerfile
├── docker-compose.yml
└── README.md