Getting Started with Digibit

This guide will help you set up your development environment and start working with the Digibit ERP system.

Prerequisites

Before you begin, ensure you have the following installed on your system:

  • Node.js (v18 or higher)
  • npm (v8 or higher) or yarn
  • Angular CLI (v18 or higher)
  • Git

Installation Steps

1. Clone the Repository

git clone <repository-url>
cd digibit

2. Install Dependencies

npm install

This will install all the necessary packages listed in package.json.

3. Environment Configuration

Create a .env file in the root directory with the following variables:

SUPABASE_URL=your_supabase_project_url
SUPABASE_ANON_KEY=your_supabase_anon_key
BACKEND_URL=your_backend_api_url

Alternatively, you can configure these in the environment.ts file located at src/environments/environment.ts.

4. Run the Development Server

ng serve

The application will be accessible at http://localhost:4200/.

5. Build for Production

To create a production build:

ng build --configuration production

Project Structure

The main application files are located in the src/app/ directory:

src/
├── app/
│   ├── environments/     # Environment configurations
│   ├── features/         # Feature modules
│   ├── guards/           # Route guards
│   ├── models/           # Data models
│   ├── pages/            # Page components
│   ├── services/         # Service implementations
│   ├── types/            # TypeScript type definitions
│   ├── utils/            # Utility functions
│   └── app.ts            # Main application component

Development Workflow

Creating New Components

Use Angular CLI to generate new components:

ng generate component pages/my-feature/my-component

Creating New Services

Generate services with:

ng generate service services/my-service

Running Tests

Execute unit tests:

ng test

Run end-to-end tests:

ng e2e

Common Commands

Command Description
ng serve Starts the development server
ng build Builds the application for production
ng generate component <name> Creates a new component
ng generate service <name> Creates a new service
ng test Runs unit tests
ng lint Checks code for linting errors

Troubleshooting

Common Issues

  1. Module not found errors: Run npm install to ensure all dependencies are installed
  2. Port already in use: Use ng serve --port 4201 to use a different port
  3. Build errors: Clear cache with ng cache clean and rebuild

Updating Dependencies

To update Angular and other dependencies:

ng update

Next Steps

After setting up your development environment:

  1. Explore the Architecture to understand the system design
  2. Check out the Components documentation to learn about UI elements
  3. Review the Services to understand backend integration
  4. Look at the Features to see what functionality is available