DBrift is a full-stack Database-as-a-Service (DBaaS) platform that empowers developers to dynamically create, manage, and provision isolated database instances through an intuitive web interface. No manual database installation or configuration neededβjust sign up, log in, and launch your database in seconds.
This project demonstrates real-world full-stack development by integrating Spring Boot backend orchestration, React frontend UI, Docker containerization, and cloud-ready deployment patterns.
- User Registration & Authentication: Secure sign-up and login with credential management
- User Dashboard: Centralized hub to view and manage all provisioned databases
- One-Click Database Creation: Instantly provision database instances with selected type and version
- Automatic Container Management: Backend automatically launches isolated Docker containers for each database
- Unique Port Assignment: Each database is assigned a unique port for secure isolation
- Credential Generation: Automatic username/password generation with secure storage
- Database Metadata Storage: All database information persisted and easily accessible
- Database Listing: View all active databases with connection details
- Connection Information: Display generated credentials (host, port, username, password)
- Database Deletion: Safe cleanup and container removal to prevent resource conflicts
- Lifecycle Management: Full control over database instance lifecycle
- Docker-Based Isolation: Each database runs in an isolated container for maximum security and portability
- Resource Efficiency: Lightweight containerization enables multiple databases on single host
- Fast Provisioning: Container-based approach enables near-instant database deployment
- Clean Lifecycle: Automated cleanup prevents resource leaks and port conflicts
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend (React/Vite) β
β - Authentication UI (Login/Sign-up) β
β - Database Dashboard β
β - Database Creation Panel β
β - Connection Details Display β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
(REST API via HTTP)
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Backend (Spring Boot) β
β - User Service & Repository β
β - Database Service & Repository β
β - Authentication & Authorization β
β - Database Provisioning Logic β
β - Docker Container Orchestration β
β - Port Management & Credential Generation β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
(Docker API / Container Runtime)
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Infrastructure Layer β
β - Docker Engine β
β - Containerized Database Instances β
β - Isolated Networks & Port Mappings β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- User Registration: Frontend β Backend β Database Storage
- Database Creation: Frontend β Backend β Docker API β Container Launch
- Database Retrieval: Frontend β Backend β Database Query β Dashboard Display
- Database Deletion: Frontend β Backend β Container Stop/Remove β Metadata Cleanup
- Framework: Spring Boot (Java)
- Database Persistence: JPA/Hibernate with SQL database
- Container Orchestration: Docker API integration
- Build Tool: Maven
- Port Management: Dynamic port allocation system
- Framework: React 18 with Vite
- Styling: CSS3 with custom animations
- State Management: React Context API
- HTTP Client: Axios for REST API communication
- UI Components: Custom React components with smooth transitions
- Containerization: Docker
- Supported Database Types: PostgreSQL, MySQL, MongoDB (extensible)
- Isolation: Container-based network isolation
- Lifecycle: Automated provisioning and cleanup
- Node.js 16+ (for frontend development)
- Java 11+ (for backend)
- Maven 3.6+ (for backend builds)
- Docker Desktop (for container management)
- Git
git clone <repository-url>
cd DBrift-demo2cd backend
# Build the backend
mvn clean install
# Run the backend (default port: 8080)
mvn spring-boot:runThe backend API will be available at http://localhost:8080
cd Frontend
# Install dependencies
npm install
# Run development server (default port: 5173)
npm run devThe frontend will be available at http://localhost:5173
Ensure Docker Desktop is running. The backend will use Docker API to provision database containers.
- Navigate to
http://localhost:5173in your browser - Sign up for a new account
- Log in with your credentials
- Click "Create Database" to provision a new database
- Select database type and configuration
- Access your database connection details from the dashboard
- Use the provided credentials to connect externally (via DBeaver, psql, mysql client, etc.)
DBrift-demo2/
βββ backend/ # Spring Boot Application
β βββ src/main/java/org/utej/backend/
β β βββ BackendApplication.java # Main Spring Boot entry point
β β βββ User.java # User entity model
β β βββ UserService.java # User business logic
β β βββ UserController.java # User REST endpoints
β β βββ UserRepository.java # User data access layer
β β βββ Database.java # Database entity model
β β βββ DatabaseService.java # Database provisioning logic
β β βββ DatabaseController.java # Database REST endpoints
β β βββ DatabaseRepository.java # Database data access layer
β β βββ CreateDatabaseRequest.java # DTO for database creation
β β βββ LoginRequest.java # DTO for authentication
β β βββ GlobalPorts.java # Port management system
β β βββ GlobalPorts.java # Port allocation logic
β βββ src/main/resources/
β β βββ application.properties # Spring Boot configuration
β β βββ infra/scripts/postgres/ # Database setup scripts
β βββ pom.xml # Maven dependencies
β βββ mvnw # Maven wrapper
β
βββ Frontend/ # React Application
β βββ src/
β β βββ components/ # React components
β β β βββ LoginForm.jsx
β β β βββ SignupForm.jsx
β β β βββ DatabaseGrid.jsx
β β β βββ CreateDatabasePanel.jsx
β β β βββ CredentialsDisplay.jsx
β β β βββ TopNav.jsx
β β βββ pages/ # Page components
β β β βββ AuthPage.jsx
β β β βββ DashboardPage.jsx
β β β βββ LandingPage.jsx
β β βββ context/ # React Context (state management)
β β β βββ AuthContext.jsx
β β βββ services/ # API service layer
β β β βββ api.js
β β βββ styles/ # CSS stylesheets
β β βββ App.jsx # Root component
β β βββ main.jsx # Vite entry point
β βββ package.json # Node dependencies
β βββ vite.config.js # Vite configuration
β βββ index.html # HTML entry point
β
βββ run.sh # Start both backend and frontend
βββ close.sh # Stop services
βββ README.md # This file
POST /api/users/register
Content-Type: application/json
{
"username": "john_doe",
"password": "secure_password"
}
POST /api/users/login
Content-Type: application/json
{
"username": "john_doe",
"password": "secure_password"
}
POST /api/databases/create
Content-Type: application/json
Authorization: Bearer <token>
{
"databaseType": "postgres",
"version": "15",
"userId": "<user_id>"
}
GET /api/databases/<userId>
Authorization: Bearer <token>
DELETE /api/databases/<databaseId>
Authorization: Bearer <token>
For detailed API documentation, see API_DOCUMENTATION.md
- Database Request: User submits database creation request via frontend
- Backend Processing: Spring Boot service receives request
- Port Allocation: System assigns available port from pool
- Container Launch: Docker API creates new container with:
- Selected database image (PostgreSQL, MySQL, etc.)
- Assigned port mapping
- Auto-generated credentials
- Persistent volume (if configured)
- Metadata Storage: Database connection info stored in application database
- Frontend Display: User sees credentials and connection details
- Create: Automated on database provisioning request
- Run: Continuous execution until deletion
- Delete: Safe cleanup with container stop and removal
- Cleanup: Automatic port deallocation and metadata removal
Current Approach: Each user's database request creates a new isolated Docker container.
Optimal Enhancement Strategy: Instead of creating multiple individual Docker containers per user database, optimize resource utilization by:
- Shared Database Containers: Create containerized database instances (one container per database type/version combination)
- Per-User Database Provisioning: Within each container, create individual databases for each user
- Credential Management: Generate unique usernames and passwords for each user
- Permission Assignment: Grant granular permissions to each user's database within the container
- Resource Efficiency: Multiple user databases coexist within a single container, reducing:
- Container overhead
- Memory footprint
- Host system resource consumption
- Port allocation pressure
Benefits of Database-Based Approach:
- β Reduced Resource Usage: One shared container vs. multiple individual containers
- β Better Scalability: Serve more users with fewer resources
- β Simplified Management: Centralized database administration
- β Cost Efficiency: Lower infrastructure costs for cloud deployments
- β Improved Performance: Reduced context switching and virtualization overhead
- β Easier Backups: Single container backup covers multiple user databases
- β Faster Provisioning: Database/user creation faster than container creation
This strategy maintains full isolation at the database/user level while optimizing at the container infrastructure level, making DBrift more production-ready for scale.
cd backend
# Build without running
mvn clean package
# Run tests
mvn test
# Run with debug mode
mvn spring-boot:run -Dspring-boot.run.arguments="--debug"cd Frontend
# Development server with hot reload
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview# View running containers
docker ps
# View all containers (including stopped)
docker ps -a
# View logs for a database container
docker logs <container_id>
# Stop all containers
docker stop $(docker ps -q)
# Remove all containers
docker rm $(docker ps -aq)