Skip to content

Latest commit

 

History

History
151 lines (104 loc) · 3.82 KB

File metadata and controls

151 lines (104 loc) · 3.82 KB

Local Deployment Guide

This guide provides detailed instructions for setting up a local development environment for the Devoby waste management application.

Prerequisites

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

  • Node.js: Version 18.x or later
  • npm or yarn: For package management
  • Git: For version control

Step 1: Clone the Repository

```bash git clone https://github.com/yourusername/devoby.git cd devoby ```

Step 2: Install Dependencies

```bash

Using npm

npm install

Using yarn

yarn install ```

Step 3: Set Up Environment Variables

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

```

Firebase Configuration

FIREBASE_API_KEY=your_firebase_api_key FIREBASE_AUTH_DOMAIN=your_firebase_auth_domain FIREBASE_PROJECT_ID=your_firebase_project_id FIREBASE_STORAGE_BUCKET=your_firebase_storage_bucket FIREBASE_MESSAGING_SENDER_ID=your_firebase_messaging_sender_id FIREBASE_APP_ID=your_firebase_app_id

Google Maps

NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=your_google_maps_api_key

Mobile Money API (Placeholders)

MTN_MOBILE_MONEY_API_KEY=your_mtn_api_key ORANGE_MONEY_API_KEY=your_orange_api_key ```

Obtaining API Keys

  1. Firebase Configuration:

    • Create a project in the Firebase Console
    • Go to Project Settings > General > Your Apps
    • Register a web app and copy the configuration values
  2. Google Maps API Key:

    • Go to the Google Cloud Console
    • Create a new project or select an existing one
    • Enable the Maps JavaScript API, Geocoding API, and Directions API
    • Create an API key and copy it

Step 4: Run the Development Server

```bash

Using npm

npm run dev

Using yarn

yarn dev ```

The application will be available at http://localhost:3000.

Step 5: Testing the Application

  1. Open your browser and navigate to http://localhost:3000
  2. Test the authentication flow by signing up or logging in
  3. Explore the dashboard and test the waste collection request flow
  4. Test the collector discovery and booking process

Development Tools

Code Linting and Formatting

```bash

Run ESLint

npm run lint

Format code with Prettier

npm run format ```

Building for Production

To create a production build locally:

```bash

Using npm

npm run build npm start

Using yarn

yarn build yarn start ```

Troubleshooting Common Issues

API Key Issues

Symptom: Maps not loading or Firebase authentication failing

Solution:

  • Verify that your API keys are correctly set in the .env.local file
  • Ensure that the APIs are enabled in the Google Cloud Console
  • Check that your Firebase project has the Authentication service enabled

Port Conflicts

Symptom: Error message about port 3000 being in use

Solution:

  • Kill the process using port 3000: npx kill-port 3000
  • Or start the server on a different port: npm run dev -- -p 3001

Node.js Version Issues

Symptom: Unexpected errors during installation or startup

Solution:

  • Verify your Node.js version: node -v
  • Use nvm to install the correct version: nvm install 18 and nvm use 18

Missing Dependencies

Symptom: Module not found errors

Solution:

  • Delete the node_modules folder and reinstall dependencies
  • Ensure you're using the correct package manager (npm or yarn) consistently

Next Steps

After setting up your local development environment, you might want to:

  1. Customize the application theme (see Theming Guide)
  2. Implement additional features
  3. Set up continuous integration for testing
  4. Deploy to a production environment (see Vercel Deployment Guide or Docker Deployment Guide)