Skip to content

Vikrantsingh22/radix-dashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ Radix Abuse Mitigation System

A comprehensive full-stack solution for tracking and managing domain abuse reports with automated risk assessment and enterprise-grade dashboard

Backend Frontend Test Coverage


πŸ“‹ Overview

This monorepo contains a complete Trust & Safety platform with two main components:

  • Backend API - RESTful API with JWT authentication, automated risk detection, and comprehensive report management
  • Frontend Dashboard - Professional web interface for monitoring and managing abuse reports

πŸš€ Quick Start

Prerequisites

  • Node.js v18.17.0 or higher
  • npm v9.0.0 or higher

Installation

# 1. Install backend dependencies
cd backend
npm install

# 2. Configure backend environment
cp .sample.env .env
# Edit .env with your configuration

# 3. Start backend server (Port 3000)
npm run dev

# 4. In a new terminal, install frontend dependencies
cd ../frontend
npm install

# 5. Start frontend (Port 3001)
npm run dev

Access the Application


πŸ“‚ Project Structure

radix-assignment/
β”œβ”€β”€ backend/                    # Express.js REST API
β”‚   β”œβ”€β”€ config/                # Database and constants
β”‚   β”œβ”€β”€ controller/            # Business logic
β”‚   β”œβ”€β”€ middleware/            # Auth, logging, error handling
β”‚   β”œβ”€β”€ routes/                # API endpoints
β”‚   β”œβ”€β”€ tests/                 # Jest test suite (110 tests)
β”‚   β”œβ”€β”€ database/              # SQLite database
β”‚   β”œβ”€β”€ .env.example           # Environment template
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ server.js              # Entry point
β”‚   └── README.md              # πŸ“– Detailed backend documentation
β”‚
β”œβ”€β”€ frontend/                   # Next.js 15 Dashboard
β”‚   β”œβ”€β”€ app/                   # Next.js App Router
β”‚   β”œβ”€β”€ components/            # React components
β”‚   β”œβ”€β”€ lib/                   # API client, auth, utilities
β”‚   β”œβ”€β”€ public/                # Static assets
β”‚   β”œβ”€β”€ package.json
β”‚   └── README.md              # πŸ“– Detailed frontend documentation
β”‚
└── README.md                   # This file

πŸ“š Documentation

Each component has comprehensive documentation:

πŸ”§ Backend Documentation

Location: backend/README.md

Topics Covered:

  • Complete API reference with cURL examples
  • Authentication & JWT configuration
  • Database schema and initialization
  • Risk assessment algorithm
  • Testing guide (87% coverage)
  • Security features and best practices
  • Troubleshooting common issues

Quick Links:


🎨 Frontend Documentation

Location: frontend/README.md

Topics Covered:

  • User interface walkthrough
  • Component architecture
  • CSV bulk upload guide
  • Deployment instructions (Vercel, Netlify)
  • Environment configuration
  • Troubleshooting UI issues

Quick Links:


πŸ”‘ Key Features

Backend API

  • βœ… JWT authentication with bcrypt password hashing
  • βœ… Automated risk assessment (High/Medium/Low)
  • βœ… Bulk report processing (up to 100 per request)
  • βœ… Advanced filtering and pagination
  • βœ… Comprehensive test coverage (110 tests)
  • βœ… Winston-based structured logging
  • βœ… SQL injection protection

Frontend Dashboard

  • βœ… Real-time analytics with interactive charts
  • βœ… CSV bulk upload with validation
  • βœ… Domain-specific detailed views
  • βœ… Status management workflow
  • βœ… Responsive design (mobile-ready)
  • βœ… Professional admin UI with shadcn/ui
  • βœ… Toast notifications and error handling

πŸ› οΈ Technology Stack

Component Technologies
Backend Node.js, Express.js, SQLite, JWT, bcryptjs, Winston
Frontend Next.js 15, React 19, TypeScript, Tailwind CSS v4, shadcn/ui
Testing Jest, Supertest (87% coverage)
Data Axios, React Hook Form, Zod, PapaParse, Recharts

πŸ§ͺ Testing

# Run backend tests
cd backend
npm test

# Run tests with coverage
npm test -- --coverage

# Watch mode
npm run test:watch

Test Coverage: 87.54% (110 tests across 6 suites)


πŸš€ Deployment

Backend Deployment

The backend can be deployed to:

  • Railway
  • Render
  • Heroku
  • AWS EC2
  • DigitalOcean

Environment Variables Required:

PORT=3000
JWT_SECRET=your_production_secret
ADMIN_USERNAME=admin
ADMIN_PASSWORD=secure_password
NODE_ENV=production

Frontend Deployment

Recommended: Vercel (one-click deploy)

Deploy with Vercel

Required Environment Variable:

NEXT_PUBLIC_API_URL=https://your-backend-api.com

For detailed deployment instructions, see frontend/README.md#deployment


πŸ”’ Security Considerations

  • πŸ” Change default admin credentials immediately
  • πŸ”‘ Use strong JWT secrets (minimum 32 characters)
  • 🌐 Configure CORS for production origins
  • πŸ›‘οΈ Enable HTTPS in production
  • πŸ“Š Review security headers (Helmet.js configured)
  • πŸ”„ Implement rate limiting for production
  • πŸ” Regular security audits with npm audit

πŸ› Common Issues

Backend Won't Start

# Check if port 3000 is in use
netstat -ano | findstr :3000

# Verify .env file exists
ls backend/.env

# Reinstall dependencies
cd backend && rm -rf node_modules && npm install

Frontend Can't Connect to Backend

  • Verify backend is running at http://localhost:3000
  • Check NEXT_PUBLIC_API_URL in .env.local
  • Confirm no CORS errors in browser console
  • Test API directly: curl http://localhost:3000/health

Authentication Issues

  • Clear browser localStorage
  • Generate new JWT token via /api/login
  • Verify JWT_SECRET matches in backend .env

For comprehensive troubleshooting, see:


πŸ“– API Quick Reference

Authentication

POST /api/login
Body: { "username": "admin", "password": "admin123" }

Reports

GET    /api/reports                # List all reports
GET    /api/report/:domain         # Get domain-specific reports
POST   /api/report                 # Create single report
POST   /api/reports/bulk           # Bulk create (CSV upload)
POST   /api/report/:id/status      # Update case status

Full API documentation: backend/README.md#api-documentation


🀝 Contributing

This is an assignment project. For any questions or issues:

  1. Check the detailed README files in backend/ and frontend/
  2. Review the test files for usage examples
  3. Consult the API documentation sections

πŸ“ž Support

For detailed information, refer to the component-specific README files:


Built with ❀️ for Trust & Safety Teams

Backend Docs Β· Frontend Docs

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published