Complete instructions for setting up and deploying the Flowcus application in various environments.
- Prerequisites
- Local Development Setup
- Database Setup
- Backend Configuration
- Frontend Configuration
- Running the Application
- Docker Deployment
- Cloud Deployment
- Production Checklist
- Troubleshooting
- .NET 7.0 SDK or later
- Node.js 16+ with npm or yarn
- PostgreSQL 12 or later
- Git
- A code editor (Visual Studio Code recommended)
- Basic understanding of .NET and Angular
- SQL basics for database management
- Command line/terminal usage
- Git version control
- Minimum 2GB RAM
- At least 500MB free disk space
- Windows, macOS, or Linux operating system
Open your terminal and clone the project:
git clone https://github.com/axewhyzed/flowcus.git
cd flowcusDownload and install PostgreSQL from https://www.postgresql.org/download/
After installation, create the database:
# Connect to PostgreSQL (you'll be prompted for the postgres user password)
psql -U postgres
# Create the database
CREATE DATABASE flowcus;
# Exit psql
\qNavigate to the database folder and execute the schema scripts:
cd FlowCus-db
# Execute each SQL file in tables/ directory
psql -U postgres -d flowcus -f tables/userlist.sql
psql -U postgres -d flowcus -f tables/task_category.sql
psql -U postgres -d flowcus -f tables/task_subtypes.sql
psql -U postgres -d flowcus -f tables/tasks.sql
psql -U postgres -d flowcus -f tables/timetables.sql
psql -U postgres -d flowcus -f tables/timetable_items.sqlVerify the tables were created:
psql -U postgres -d flowcus -c "\dt"Navigate to the backend directory:
cd FlowCus-backendRestore NuGet packages:
dotnet restoreCreate or update the appsettings configuration file. If appsettings.Development.json doesn't exist, create it:
{
"ConnectionStrings": {
"DBLocal": "Host=localhost;Port=5432;Database=flowcus;Username=postgres;Password=your_postgres_password;"
},
"Jwt": {
"Key": "your-super-secret-key-minimum-32-characters-long-for-security",
"Issuer": "FlowcusAPI",
"Audience": "FlowcusClient"
},
"AuthSettings": {
"MaxFailedAttempts": 3,
"LockoutMinutes": 15,
"BcryptWorkFactor": 12,
"IpRateLimitPerMinute": 30,
"UserRateLimitPerMinute": 10
},
"Logging": {
"LogLevel": {
"Default": "Information"
}
}
}Build the backend:
dotnet buildRun the backend:
dotnet runThe backend will start on http://localhost:7176 or https://localhost:7176, depending on the launch profile.
Open a new terminal window and navigate to the frontend directory:
cd FlowCus-frontend/flowcusInstall dependencies:
npm install
# or if you use yarn
yarn installUpdate the API base URL if needed. Edit src/environments/environment.ts:
export const environment = {
production: false,
apiUrl: 'http://localhost:7176/api',
appName: 'FlowCus'
};Start the development server:
ng serve
# or
npm startThe frontend will be available at http://localhost:4200
The application uses the following tables:
userlist - User accounts and authentication
- id (primary key)
- username (unique)
- password_hash (BCrypt hashed)
- name (display name)
- is_admin (boolean)
- created_on (timestamp)
- updated_on (timestamp)
- failed_attempts (login attempt counter)
- lockout_until (lockout timestamp)
- is_deleted (soft delete flag)
task_category - Task categories for organization
- id (primary key)
- name (category name)
- created_on (timestamp)
- is_deleted (soft delete flag)
task_subtypes - Specific task types within categories
- id (primary key)
- user_id (foreign key to userlist)
- category_id (foreign key to task_category)
- name (subtype name)
- color_hex (color code for UI)
- icon_name (icon identifier)
- created_on (timestamp)
- is_deleted (soft delete flag)
tasks - User tasks
- task_id (primary key)
- created_by (foreign key to userlist)
- title (task title)
- description (task description)
- created_on (timestamp)
- updated_on (timestamp)
- is_deleted (soft delete flag)
timetables - Weekly schedules
- id (primary key)
- user_id (foreign key to userlist)
- name (timetable name)
- is_active (currently active timetable)
- created_on (timestamp)
- updated_on (timestamp)
- is_deleted (soft delete flag)
timetable_items - Scheduled time slots within timetables
- id (primary key)
- timetable_id (foreign key to timetables)
- task_category_id (foreign key to task_category)
- task_subtype_id (foreign key to task_subtypes, nullable)
- day_of_week (0-6, Monday-Sunday)
- start_time (time in HH:MM:SS format)
- end_time (time in HH:MM:SS format)
- specific_date (override date for one-time entries)
- created_on (timestamp)
- is_deleted (soft delete flag)
Backup the database:
pg_dump -U postgres flowcus > flowcus_backup.sqlRestore from backup:
psql -U postgres -d flowcus < flowcus_backup.sqlConnectionStrings
- DefaultConnection: production PostgreSQL connection string with host, port, database, username, and password
- DBLocal: local development PostgreSQL connection string
The backend reads DefaultConnection first and falls back to DBLocal. The old encrypted connection-string flow has been removed; do not set DB_CONNECTION_ENCRYPTED or ENCRYPTION_KEY.
Jwt
- Key: Secret key for signing JWT tokens (must be at least 32 characters)
- Issuer: JWT issuer, usually
FlowcusAPI - Audience: JWT audience, usually
FlowcusClient
AuthSettings
- MaxFailedAttempts: Number of failed login attempts before lockout (default: 3)
- LockoutMinutes: Duration of account lockout in minutes (default: 15)
- BcryptWorkFactor: Password hashing strength (10-12 recommended, default: 12)
- IpRateLimitPerMinute: Rate limit for IP addresses per minute (default: 30)
- UserRateLimitPerMinute: Rate limit for user accounts per minute (default: 10)
CORS
- Allowed origins are currently configured in
FlowCus-backend/Program.cs - Development allows
http://localhost:4200 - Production allows
https://axewhyzed.github.ioandhttps://flowcus.axewhyzedlabs.co.in
Logging
- LogLevel: Set logging levels for different components
For production, use either appsettings.Production.json on the server or environment variables. Do not commit appsettings.Production.json; keep appsettings.Production.json.template in Git as the example.
Production appsettings example:
{
"ConnectionStrings": {
"DefaultConnection": "Host=prod-db;Port=5432;Database=flowcus;Username=dbuser;Password=dbpassword;"
},
"Jwt": {
"Key": "your-production-secret-key-minimum-32-characters",
"Issuer": "FlowcusAPI",
"Audience": "FlowcusClient"
}
}Equivalent environment variables:
# Database
export ConnectionStrings__DefaultConnection="Host=prod-db;Port=5432;Database=flowcus;Username=dbuser;Password=dbpassword;"
# JWT
export Jwt__Key="your-production-secret-key-minimum-32-characters"
export Jwt__Issuer="FlowcusAPI"
export Jwt__Audience="FlowcusClient"
# Auth
export AuthSettings__MaxFailedAttempts="3"
export AuthSettings__LockoutMinutes="30"
export AuthSettings__BcryptWorkFactor="14"Create environment configuration files for different deployments:
environment.ts (development)
export const environment = {
production: false,
apiUrl: 'http://localhost:7176/api',
appName: 'FlowCus'
};environment.prod.ts (production)
export const environment = {
production: true,
apiUrl: 'https://api.yourdomain.com'
};For production, update src/environments/environment.prod.ts:
export const environment = {
production: true,
apiUrl: 'https://api-flowcus.axewhyzedlabs.co.in/api',
appName: 'FlowCus'
};The frontend must be registered in the backend's CORS settings in FlowCus-backend/Program.cs:
string[] allowedOrigins = builder.Environment.IsDevelopment()
? new[] { "http://localhost:4200" }
: new[] { "https://axewhyzed.github.io", "https://flowcus.axewhyzedlabs.co.in" };Terminal 1 - Start the backend:
cd FlowCus-backend
dotnet runTerminal 2 - Start the frontend:
cd FlowCus-frontend/flowcus
ng serveTerminal 3 (optional) - Monitor the database:
psql -U postgres -d flowcusAccess the application at http://localhost:4200
After database initialization, create a test account through the registration page, or insert directly:
psql -U postgres -d flowcus
INSERT INTO userlist (username, password_hash, name, is_admin, created_on, updated_on, is_deleted)
VALUES ('admin', '$2a$12$...bcrypt_hash...', 'Administrator', true, now(), now(), false);Note: Generate the BCrypt hash using a tool or the application's authentication service.
Create a Dockerfile in the FlowCus-backend directory:
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /app
COPY . ./
RUN dotnet restore
RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build /app/out .
ENV ASPNETCORE_URLS=http://+:8080
EXPOSE 8080
CMD ["dotnet", "FlowCus.dll"]Build and run:
docker build -t flowcus-backend .
docker run -p 8080:8080 -e ConnectionStrings__DefaultConnection="..." -e Jwt__Key="your-secret-key-here" flowcus-backendCreate docker-compose.yml for full stack:
version: '3.8'
services:
db:
image: postgres:15
environment:
POSTGRES_DB: flowcus
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
backend:
build: ./FlowCus-backend
ports:
- "8080:8080"
environment:
ConnectionStrings__DefaultConnection: "Host=db;Port=5432;Database=flowcus;Username=postgres;Password=postgres;"
Jwt__Key: "your-secret-key-here"
Jwt__Issuer: "FlowcusAPI"
Jwt__Audience: "FlowcusClient"
depends_on:
- db
frontend:
build: ./FlowCus-frontend
ports:
- "80:80"
depends_on:
- backend
volumes:
postgres_data:Run with Docker Compose:
docker-compose up -d- Create App Service and PostgreSQL Flexible Server
- Update connection string in App Service Configuration
- Deploy using Azure CLI or GitHub Actions:
az webapp deployment source config-zip \
--resource-group mygroup \
--name myapp \
--src deploy.zip- Create PostgreSQL database on Render
- Deploy backend from GitHub to Render Web Service
- Deploy frontend to Render Static Site
- Update API URL in frontend environment variables
- Create RDS PostgreSQL instance
- Deploy backend to Elastic Beanstalk
- Deploy frontend to S3 + CloudFront
- Configure security groups and IAM roles
Before deploying to production, ensure:
- Database backups are configured
- SSL/TLS certificates are installed
- JWT secret key is securely stored
- Environment variables are properly set
- Rate limiting is configured appropriately
- CORS is configured for your domain only
- Password hashing work factor is set to 12+
- Error logging is configured
- Database connection pooling is enabled
- Security headers are configured
- API documentation is available to frontend team
- Database migrations are tested
- Load testing has been performed
- Security scanning has been completed
- Monitoring and alerting are configured
- Incident response plan is in place
Database connection error:
- Verify PostgreSQL is running
- Check connection string in appsettings.json
- Verify database and user exist
- Test connection:
psql -U postgres -d flowcus
Port already in use:
- Change the launch profile port in
FlowCus-backend/Properties/launchSettings.json - Or kill the process using the current backend port, for example
lsof -i :7176thenkill <PID>
JWT errors:
- Verify
Jwt:Keyis at least 32 characters - Check token expiration time
- Ensure frontend sends token in Authorization header
Rate limit locked:
- Wait for lockout period (default 15 minutes)
- Or clear in database:
UPDATE userlist SET failed_attempts = 0, lockout_until = NULL WHERE username = 'user'
Blank page or 404 error:
- Verify ng serve is running
- Check browser console for errors
- Clear browser cache and reload
- Verify API_ENDPOINTS are correct
API connection errors:
- Verify backend is running on correct port
- Check CORS configuration in backend
- Verify API URL in environment files
- Check browser console for specific errors
Time display issues:
- Verify browser timezone is correct
- Check frontend time conversion logic
- Verify database stores times in UTC
Table doesn't exist:
- Verify all SQL files were executed
- Check for errors during schema creation
- Re-run the schema scripts if needed
Performance issues:
- Check for missing indexes
- Verify query optimization
- Monitor database resource usage
- Consider connection pooling settings
Logs location:
- Backend: Console output and application event logs
- Frontend: Browser developer console (F12)
- Database: PostgreSQL logs in data directory
Getting help:
- Check application logs for error messages
- Review API responses with developer tools
- Consult PostgreSQL documentation
- Review Angular documentation for frontend issues
- Enable query result caching
- Use connection pooling
- Implement pagination for large datasets
- Monitor slow queries with EXPLAIN
- Lazy load modules
- Enable production build optimization:
ng build --configuration production - Implement virtual scrolling for large lists
- Cache API responses appropriately
- Create indexes on frequently queried columns
- Regular vacuum and analyze operations
- Monitor table sizes
- Archive old soft-deleted data periodically
- Always use HTTPS in production
- Store secrets in environment variables, not in code
- Regularly update dependencies
- Implement API rate limiting
- Enable database encryption at rest
- Use strong password requirements
- Implement audit logging
- Regular security scanning and penetration testing
- Keep PostgreSQL and .NET updated
- Monitor authentication logs for suspicious activity
After successful setup:
- Create additional user accounts
- Explore task management features
- Create task categories and subtypes
- Build your first timetable
- Check dashboard for statistics
- Review admin features if you have admin access
- Configure backup and monitoring for production
For additional help, refer to the README.md file or contact the development team.