1Welcome
Welcome to the Diamond Shop System setup guide! This interactive guide will walk you through setting up your development environment step by step.
What You'll Learn
- How to set up your development environment
- Configure Docker services for database management
- Set up local development with hot reload
- Access and manage your database with pgAdmin
- Handle Entity Framework migrations
Prerequisites Check
Before we begin, make sure you have these installed:
- ✓Docker Desktop (latest version)
- ✓.NET 8.0 SDK
- ✓Git
- ✓Visual Studio Code or Visual Studio
2Clone Repository
Let's start by getting the code on your local machine.
Clone the Repository
Replace <your-repository-url>
with the actual GitHub repository URL.
3Environment Setup
Now we need to configure your environment variables.
Create .env File
Create a .env
file in the root directory:
4Docker Setup
Let's start the database services using Docker.
Start Database Services
We'll start only PostgreSQL and pgAdmin for now:
This command will:
- Start PostgreSQL on port 5433
- Start pgAdmin on port 5050
- Run them in detached mode (
-d
)
Verify Services
5pgAdmin Setup
Now let's configure pgAdmin to access your database.
Access pgAdmin
1. Open your browser and go to: http://localhost:5050
2. Login with:
- Email: admin@admin.com
- Password: admin123
Add Database Server
3. Right-click "Servers" → "Register" → "Server"
4. Fill in the connection details:
- Name: Diamond Shop DB
- Host name/address: postgres
- Port: 5432
- Username: postgres
- Password: [Your DB_PASSWORD from .env]
6Development Setup
Now for the best part - setting up your development environment for fast iteration!
Recommended: Local Development
This approach gives you hot reload without Docker rebuilds:
Your API will be available at: http://localhost:5000
Alternative: Full Docker
If you prefer everything in Docker:
API will be available at: http://localhost:8081
7Database Migrations
Let's set up your database schema using Entity Framework migrations.
Option 1: Using Docker EF Tools
Option 2: Using Local .NET CLI
8Daily Workflow
Here's your recommended daily development workflow for maximum productivity.
🌅 Start Your Day
💻 During Development
- Edit your code - changes will automatically reload
- Use pgAdmin for database queries and management
- Create migrations when you change your models
🌙 End Your Day
9Useful Commands
Keep these commands handy for your daily development tasks.
Docker Management
Database Operations
EF Core Migrations
10Troubleshooting
Common issues and their solutions.
🚨 Common Issues
Port Conflicts
If ports 5433, 5050, or 8081 are in use, modify the port mappings in docker-compose.yml
Database Connection Issues
Permission Issues (Linux/Mac)
Add your user to the docker group or use sudo
with Docker commands.
Migration Issues
- Verify connection string points to correct database
- Check if EF Core tools are installed
- Ensure database permissions are correct
docker-compose logs [service-name]
🎉Congratulations!
You've successfully set up your Diamond Shop System development environment!
What You've Accomplished
- ✓Cloned the repository
- ✓Configured environment variables
- ✓Set up Docker services
- ✓Configured pgAdmin for database management
- ✓Set up local development with hot reload
- ✓Learned the recommended daily workflow
Next Steps
You're now ready to start developing! Here are some suggestions:
- Explore the codebase and understand the project structure
- Make a small change and see hot reload in action
- Create your first database migration
- Set up your preferred debugging tools
Your development environment is optimized for productivity with fast feedback loops and efficient database management.