Skip to content

stuartmutebi/Database_Projects

Repository files navigation

Asset Management System - Team Database Setup

🎯 Project Overview

This asset management system supports both local and team database configurations, allowing you to maintain your local database for lecturer requirements while collaborating with your team on a shared virtual database.

πŸš€ Quick Start

Prerequisites

  • Node.js and npm installed
  • Docker Desktop (for team database)
  • MySQL (for local database)

1. Install Dependencies

# Backend dependencies
cd backend
npm install

# Frontend dependencies
cd ../frontend
npm install

2. Choose Your Database Setup

Option A: Team Collaboration (Virtual Database)

# Start virtual database (requires Docker)
npm run team:start

# Configure for team database
cd backend
npm run db:team
npm run prisma:push

Option B: Local Development (Lecturer Requirements)

# Configure for local database
cd backend
npm run db:local
npm run prisma:push

3. Start Development

# Backend server
npm run dev:backend

# Frontend server (in new terminal)
npm run dev:frontend

πŸ“Š Database Configurations

Database Port Purpose Environment
Local 3307 Lecturer requirements env.local
Team 3308 Team collaboration env.team

πŸ”„ Database Management

Switching Between Databases

# Switch to team database
cd backend && npm run db:team

# Switch to local database
cd backend && npm run db:local

Data Synchronization

# Sync from local to team
npm run sync:local-to-team

# Sync from team to local
npm run sync:team-to-local

Team Database Management

# Start team database
npm run team:start

# Stop team database
npm run team:stop

# Check database status
npm run team:status

🌐 Web Interfaces

πŸ“ Project Structure

Database Design/
β”œβ”€β”€ backend/                 # Backend API
β”‚   β”œβ”€β”€ prisma/             # Database schema
β”‚   └── src/                # Source code
β”œβ”€β”€ frontend/               # Next.js frontend
β”œβ”€β”€ database/               # Database initialization
β”œβ”€β”€ scripts/                # Utility scripts
β”œβ”€β”€ docker-compose.yml      # Team database setup
β”œβ”€β”€ env.local              # Local database config
β”œβ”€β”€ env.team               # Team database config
└── TEAM_SETUP.md          # Detailed setup guide

πŸ› οΈ Available Commands

Database Management

  • npm run team:start - Start team virtual database
  • npm run team:stop - Stop team virtual database
  • npm run team:status - Check database status
  • npm run setup:team - Setup team database
  • npm run setup:local - Setup local database

Data Synchronization

  • npm run sync:local-to-team - Sync local β†’ team
  • npm run sync:team-to-local - Sync team β†’ local

Development

  • npm run dev:backend - Start backend server
  • npm run dev:frontend - Start frontend server

πŸ“š Documentation

πŸ”§ Troubleshooting

Docker Issues

  1. Install Docker Desktop
  2. Ensure Docker is running
  3. Check port 3307 is available

Database Connection Issues

  1. Verify environment files are correct
  2. Check database is running
  3. Verify credentials

Port Conflicts

  • Team database uses port 3308
  • Local database uses port 3307
  • Change ports in docker-compose.yml if needed

πŸ‘₯ Team Collaboration

For Team Members:

  1. Clone the repository
  2. Install dependencies
  3. Start team database: npm run team:start
  4. Configure for team: cd backend && npm run db:team
  5. Start development: npm run dev:backend

Data Sharing:

  • Use npm run sync:local-to-team to share your local data
  • Use npm run sync:team-to-local to get team updates
  • Always backup before syncing

πŸ“ž Support

If you encounter issues:

  1. Check the troubleshooting section
  2. Verify Docker is running
  3. Check database logs: docker compose logs db
  4. Ensure no port conflicts

About

This Repository contains all our Database projects

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 5