Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

308 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“± Telecom Billing System

Version Java SvelteKit NeonDB Status

A modular, production-ready Telecom Billing System built with Java 21 (Jakarta EE 11) backend and SvelteKit 5.x reactive frontend. Features real-time billing, CDR processing, PDF invoicing, and comprehensive admin controls.


πŸ“‹ Table of Contents


πŸ—οΈ Architecture Stack

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    SYSTEM ARCHITECTURE                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚
β”‚   β”‚ SvelteKitβ”‚ ←── β”‚  Tomcat 11   β”‚ ←── β”‚  Java 21  β”‚         β”‚
β”‚   β”‚   5.x    β”‚     β”‚ Embedded     β”‚     β”‚  Backend  β”‚         β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚
β”‚        ↓                                        ↓              β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”‚
β”‚   β”‚             HikariCP Connection Pool              β”‚        β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚
β”‚        ↓                                                     β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”‚
β”‚   β”‚                  NeonDB Cloud                     β”‚        β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚
β”‚                                                                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Layer Details

Layer Technology Version Purpose
πŸ’» Backend Java 21 Core language
🌐 Framework Jakarta EE 11 Enterprise APIs
πŸ–₯️ Server Tomcat 11.0.21 Embedded servlet
πŸ—„οΈ Database NeonDB 3.x Cloud PostgreSQL
πŸ”„ Pool HikariCP 6.2.1 Connection pooling
πŸ“„ JSON Jackson 2.17.0 JSON processing
πŸ“Š Reports JasperReports 7.0.1 PDF invoices
🎨 Frontend SvelteKit 5.x Reactive UI
✨ Styling Tailwind CSS 4.0.0 Dark mode UI

πŸš‚ Deployment

Railway Deployment

The app is configured for seamless deployment on Railway with automatic health checks and environment variable support.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 RAILWAY SETUP                                    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  πŸš‚ Platform          β”‚  Railway (railway.app)                 β”‚
β”‚  🌐 Database         β”‚  NeonDB (your project)                β”‚
β”‚  πŸ”Œ Connection       β”‚  JDBC with SSL required                β”‚
β”‚  ❀️ Health Check     β”‚  GET /health                          β”‚
β”‚  πŸ“¦ Build            β”‚  Docker multi-stage build             β”‚
β”‚  πŸ”„ Deploy           β”‚  Automatic on git push              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Environment Variables

Variable Description Example
DB_URL NeonDB JDBC URL jdbc:postgresql://your-endpoint.neondb?sslmode=require
DB_USER Database user (from NeonDB dashboard)
DB_PASSWORD Database password (from NeonDB dashboard)
CDR_INPUT_PATH Input directory /app/input
CDR_PROCESSED_PATH Processed directory /app/processed

Railway Health Check

# Health endpoint (used for deployment detection)
GET https://your-app.railway.app/health

# Response:
# {"status":"UP","timestamp":"2026-04-30T12:00:00Z"}

Deploy to Railway

# 1. Install Railway CLI
npm i -g @railway/cli

# 2. Login
railway login

# 3. Init project
railway init

# 4. Set environment variables (from NeonDB dashboard)
railway variables set DB_URL="jdbc:postgresql://..."
railway variables set DB_USER="..."
railway variables set DB_PASSWORD="..."

# 5. Deploy
railway deploy

# Or connect GitHub repo for auto-deploy:
# https://railway.app/new

Docker Configuration

# Multi-stage build for Railway
FROM maven:3.9.6-eclipse-temurin-21 AS build
WORKDIR /build

COPY pom.xml .
RUN mvn dependency:go-offline -B

COPY . .
RUN mvn package -DskipTests -B

FROM eclipse-temurin:21-jre-jammy
WORKDIR /app

# Security: Run as non-root user
RUN addgroup --system javauser && adduser --system --ingroup javauser javauser

# Install curl for health checks
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*

# Create directories
RUN mkdir -p /app/input /app/processed && chown -R javauser:javauser /app

# Copy artifacts
COPY --from=build /build/target/Telecom-Billing-Engine.jar app.jar
COPY --from=build /build/target/lib ./lib
COPY --from=build /build/src/main/webapp ./webapp_static
COPY --from=build /build/src/main/resources/invoice.jrxml .
COPY --from=build /build/src/main/resources/logo.svg .
COPY --from=build /build/src/main/resources/Pictures ./Pictures

# Set ownership
RUN chown -R javauser:javauser /app

# Switch to non-root user
USER javauser

# Expose port
EXPOSE 8080

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
  CMD curl -f http://localhost:8080/health || exit 1

# Run command
ENTRYPOINT ["java", "-Xmx1g", "-Djava.awt.headless=true", "-cp", "app.jar:lib/*", "com.billing.Main"]

✨ Key Features

πŸ‘‘ Admin Features

Feature Endpoint Description
πŸ“Š Dashboard /admin Real-time stats & metrics
πŸ‘₯ Customers /admin/customers Full customer CRUD
πŸ“„ Contracts /admin/contracts Contract management
πŸ’° Billing /admin/bills Bill generation & payment
πŸ“ˆ CDR /admin/cdr CDR upload & viewing
πŸ“¦ Packages /admin/service-packages Service packages
πŸ“΅ Rate Plans /admin/rateplans Tariff plans
πŸ” Audit /admin/audit Missing bill detection

πŸ‘€ Customer Features

Feature Endpoint Description
πŸ‘€ Profile /profile View & edit profile
πŸ“± Contracts /profile/contracts My contracts
πŸ“„ Invoices /profile/invoices Invoice history
πŸ“₯ Download /profile/invoices/download PDF downloads
πŸ›’ Add-ons /customer/addons Purchase add-ons
πŸ“ Register /register Self-registration

βš™οΈ Backend Features

Feature Description
πŸ—‚οΈ CDR Engine Java CSV parser for call records
πŸ§ͺ CDR Generator Test data generation
πŸ“„ Jasper 7 PDF with element-kind schema
πŸ€– Automation Server-side billing (14% tax)
❀️ Health Railway-compatible /health endpoint

πŸš€ Quick Start

Development (IDE)

# 1. Configure secrets
cp .env.example .env

# 2. Edit .env with your NeonDB credentials
# DB_URL=jdbc:postgresql://your-endpoint.neondb?sslmode=require
# DB_USER=your_username
# DB_PASSWORD=your_password

# 3. Run in IntelliJ
#    File β†’ Project Structure β†’ Run Configurations
#    Select Main class β†’ Environment β†’ .env file

# 4. Run
com.billing.Main

Production (Railway)

# Option 1: Deploy via GitHub (recommended)
# 1. Push code to GitHub
# 2. Create project at railway.app
# 3. Connect GitHub repository
# 4. Add environment variables in Railway dashboard
# 5. Deploy automatically on push

# Option 2: Deploy via CLI
railway init
railway deploy

Production (Local Container)

# Build the JAR
./mvnw clean package -DskipTests

# Launch with Podman/Docker
podman-compose up -d --build

# Verify health
curl http://localhost:8080/health

πŸ—„οΈ Database Schema

NeonDB Configuration

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  NEONDB CONFIGURATION                            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  🌐 Service          β”‚  NeonDB Cloud                           β”‚
β”‚  πŸ“ Endpoint        β”‚  (your-project-name)                   β”‚
β”‚  πŸ“‚ Database        β”‚  neondb                               β”‚
β”‚  πŸ”’ SSL             β”‚  Required (sslmode=require)            β”‚
β”‚  πŸ”„ Pooling         β”‚  HikariCP with 10 connections          β”‚
β”‚  πŸ’Ύ Type            β”‚  PostgreSQL compatible               β”‚
β””β”€β”€β”€β”€β”€β”€οΏ½οΏ½β”€οΏ½οΏ½β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

14 Tables

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      CORE TABLES                                β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  user_account          β”‚  Customers & administrators         β”‚
β”‚  rateplan            β”‚  Tariff plans                        β”‚
β”‚  service_package    β”‚  Bundled services                   β”‚
β”‚  rateplan_service_package β”‚  Rateplan ↔ Package links       β”‚
β”‚  contract           β”‚  Customer contracts                 β”‚
β”‚  contract_consumptionβ”‚  Usage tracking                    β”‚
β”‚  ror_contract       β”‚  Applied rates                      β”‚
β”‚  bill               β”‚  Billing invoices                  β”‚
β”‚  invoice            β”‚  PDF records                      β”‚
β”‚  cdr                β”‚  Call detail records               β”‚
β”‚  file               β”‚  CDR file tracking                β”‚
β”‚  rejected_cdr       β”‚  Rejected records                 β”‚
β”‚  contract_addon     β”‚  Customer add-ons                 β”‚
β”‚  msisdn_pool        β”‚  Phone number pool                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

60+ Functions

-- Core Billing
SELECT generate_bill(1, '2026-04-01');
SELECT generate_all_bills('2026-04-01');

-- Contract Management
SELECT create_contract(1, 2, '201000000001', 500);
SELECT change_contract_status(1, 'suspended');
SELECT change_contract_rateplan(1, 2);

-- Customer
SELECT login('username', 'password');
SELECT get_all_customers('search', 50, 0);

-- Add-ons
SELECT purchase_addon(1, 3);
SELECT get_contract_addons(1);

3 Triggers

Trigger Event Action
trg_auto_rate_cdr AFTER INSERT Auto-rate CDR
trg_auto_initialize_consumption BEFORE INSERT Init period
trg_bill_payment AFTER UPDATE Restore credit

πŸ”Œ API Reference

Public Endpoints

Method Endpoint Description
🟒 GET /health Health check

Authentication

Method Endpoint Description
⚑ POST /api/auth/login User login
⚑ POST /api/auth/register New customer
⚑ POST /api/auth/logout User logout
🟒 GET /api/auth/verify Verify session

Customer

Method Endpoint Description
🟒 GET /api/customer/profile Get profile
🟑 PUT /api/customer/profile Update profile
🟒 GET /api/customer/contracts My contracts
🟒 GET /api/customer/invoices My invoices
🟒 GET /api/customer/invoices/download Download PDF
🟒 GET /api/customer/addons My add-ons
⚑ POST /api/customer/addons Purchase add-on
🟒 GET /api/onboarding/available-msisdn Phone numbers
⚑ POST /api/onboarding/create-contract New contract

Admin

Method Endpoint Description
🟒 GET /api/admin/customers List customers
⚑ POST /api/admin/customers Create customer
🟒 GET /api/admin/customers/* Get customer
🟑 PUT /api/admin/customers/* Update customer
πŸ”΄ DELETE /api/admin/customers/* Delete customer
🟒 GET /api/admin/contracts List contracts
⚑ POST /api/admin/contracts Create contract
🟑 PUT /api/admin/contracts/*/status Change status
🟑 PUT /api/admin/contracts/*/rateplan Change rateplan
🟒 GET /api/admin/cdr List CDRs
⚑ POST /api/admin/cdr/upload Upload CDR
⚑ POST /api/admin/cdr/generate Generate test
🟒 GET /api/admin/bills List bills
⚑ POST /api/admin/bills/*/pay Pay bill
⚑ POST /api/admin/bills/generate-all Generate all
🟒 GET /api/admin/stats Dashboard stats
🟒 GET /api/admin/audit/missing Missing bills

πŸ›‘οΈ Security Audit

Component Status Description
πŸ” Identity βœ… Non-root javauser
πŸ”’ Secrets βœ… Environment variable priority
πŸ“Š Observability βœ… /health endpoint
πŸ”§ Build βœ… LICENSE/NOTICE merge
πŸ“„ Reporting βœ… JIT caching
🌐 Assets βœ… Container-native
πŸ”€ Routing βœ… SPA normalization
🎨 Frontend βœ… State fixes
πŸ’³ Billing βœ… Idempotent upsert
πŸš‚ Railway βœ… Auto-deploy ready

πŸ—ΊοΈ Roadmap

Phase 3: Advanced Auditability

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  CARRIER-GRADE FEATURES                    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  cdr_rating_detail    β”‚  Per-bundle consumption audit    β”‚
β”‚  Multi-Bucket       β”‚  Split across rating events  β”‚
β”‚  Itemized Logs      β”‚  Millisecond-accurate trailβ”‚
β”‚  Dual Rating       β”‚  Wholesale & retail rates β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“± FMRZ Telecom Group

Version 2.0 | April 2026 | Production Ready πŸŽοΈπŸ›‘οΈπŸš€

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages