Complete list of steps to get the Restricted Email Blocklist system up and running.
- Node.js 18+ installed (
node --version) - PostgreSQL 12+ installed and running
- Terminal/Command prompt available
- Code editor open with the project
# 1. Verify PostgreSQL is running
pg_isready
# 2. Create database (if not exists)
createdb restricted_emails_db
# 3. Note: Migrations will create all tables automaticallyStatus: ✓ Database ready
# 1. Navigate to backend
cd backend
# 2. Install dependencies
npm install
# 3. Create environment file
cp .env.example .env
# 4. Run database migrations (creates tables + seed data)
npm run db:migrate
# 5. Start backend server
npm run devCheck: Backend should log "✓ Server running on http://localhost:3000"
Status: ✓ Backend running
# 1. Open NEW TERMINAL (keep backend running)
cd frontend
# 2. Install dependencies
npm install
# 3. Start frontend dev server
npm run devCheck: Frontend should log "http://localhost:3001"
Status: ✓ Frontend running
-
Open Browser
- Visit:
http://localhost:3001 - Should see: Dark dashboard titled "Restricted Email Blocklist"
- Visit:
-
Click "Add Entry"
- Pattern:
testemail - Type:
Exact Match - Click Create
- Should appear in table
- Pattern:
-
Test API
curl http://localhost:3000/api/blocklist | head -20- Should return JSON with entries
-
Test Validation
curl -X POST http://localhost:3000/api/blocklist/validate \ -H "Content-Type: application/json" \ -d '{"email":"testemail@example.com"}'
- Should return
"isBlocked": true
- Should return
Status: ✓ System fully functional
- Click "Add Entry"
- Pattern:
admin - Type:
Exact Match - Click Create
- Try validating:
curl ... testemail admin@example.com - Response:
"isBlocked": true
- Click "Add Entry"
- Pattern:
blocked.com - Type:
Domain - Click Create
- Notice you can select "All Domains" or specific domains
- Click "Bulk Import"
- Click "Load Template"
- Add more lines with different patterns
- Click "Import"
- See all entries added to table
- Click "Export CSV"
- File downloads as
restricted-emails-<timestamp>.csv - Can re-import later
List all entries:
curl http://localhost:3000/api/blocklist?pageSize=5Get single entry:
curl http://localhost:3000/api/blocklist/{entry-id}Create entry:
curl -X POST http://localhost:3000/api/blocklist \
-H "Content-Type: application/json" \
-d '{"pattern":"test","type":"exact","reason":"Test"}'Validate email:
curl -X POST http://localhost:3000/api/blocklist/validate \
-H "Content-Type: application/json" \
-d '{"email":"test@example.com"}'View audit log:
curl http://localhost:3000/api/blocklist/audit/allcd backend
# Run all tests
npm test
# Run with coverage
npm test -- --coverage
# Run specific test file
npm test -- emailBlocklist.test.ts# Stop backend: Ctrl+C in backend terminal
# Stop frontend: Ctrl+C in frontend terminal
# Stop PostgreSQL: brew services stop postgresql@15See register-example.ts for complete example code showing:
- How to import the blocklist service
- How to check if email is blocked
- How to return proper error messages
- How to log blocked attempts
Key code snippet:
const blockCheck = await blocklistService.isEmailBlocked(email);
if (blockCheck.isBlocked) {
return res.status(403).json({
error: blockCheck.reason || 'Email is restricted'
});
}| File | Purpose |
|---|---|
| QUICKSTART.md | Fast setup guide (you are here) |
| README.md | Complete documentation |
| DEPLOYMENT.md | Production deployment guide |
| PROJECT_STRUCTURE.md | Detailed file organization |
- Get it running ← You are here
- Try the examples above
- Read the full API docs in README.md
- Review integration code in register-example.ts
- Deploy to production using DEPLOYMENT.md
| Issue | Solution |
|---|---|
| "PostgreSQL not running" | brew services start postgresql@15 |
| "Port 3000 in use" | Change PORT in .env or kill process: lsof -i :3000 | kill... |
| "Database doesn't exist" | Run: npm run db:migrate |
| "Module not found" | Run: npm install in both folders |
| "CORS error in frontend" | Ensure backend is running on :3000 |
| "Can't connect to database" | Check .env credentials, PostgreSQL running |
- Search: Type in search box to filter by pattern
- Filter Type: Select Exact/Domain/Regex from dropdown
- Filter Domain: Enter domain name to show only rules for that domain
- Sort: Click table headers (when implemented)
- Edit: Click pencil icon on row
- Delete: Click trash icon on row (with confirmation)
- Pagination: Use Previous/Next buttons at bottom
.env- Contains local database credentialsNODE_ENV=development- Enables verbose logging- Default CORS opens to
http://localhost:3001
For production, see DEPLOYMENT.md with hardening steps.
You now have a fully functional Restricted Email Blocklist system:
- ✅ Admin dashboard
- ✅ REST API
- ✅ Email validation
- ✅ Audit logging
- ✅ Bulk operations
- ✅ Multi-domain support
Next Step: Integrate with your registration endpoint using the code example, then deploy to production!
For more details, see README.md →