File size: 3,275 Bytes
25b7e73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Nature Intelligence for Business Platform - Development Setup

## Overview

This document provides instructions for setting up and running the Nature Intelligence for Business Platform locally for development purposes.

## Prerequisites

- Docker and Docker Compose
- Node.js (for local development without Docker)
- Python 3.11+ (for local development without Docker)

## Quick Start with Docker

1. Clone the repository
2. Navigate to the project root directory
3. Run the following command:

```bash
docker-compose up --build
```

This will start three services:
- Frontend (Next.js) on http://localhost:3000
- Backend (FastAPI) on http://localhost:8000
- PostgreSQL with PostGIS on port 5432

## Manual Setup

### Backend

1. Navigate to the `backend` directory:
```bash
cd backend
```

2. Create a virtual environment:
```bash
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
```

3. Install dependencies:
```bash
pip install -r requirements.txt
```

4. Run the development server:
```bash
python dev.py
```

The backend API will be available at http://localhost:8000

### Frontend

1. Navigate to the `frontend` directory:
```bash
cd frontend
```

2. Install dependencies:
```bash
npm install
```

3. Run the development server:
```bash
npm run dev
```

The frontend will be available at http://localhost:3000

## API Documentation

Once the backend is running, you can access the API documentation at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc

## Project Structure

```
nature-intelligence/
β”œβ”€β”€ frontend/              # Next.js frontend application
β”‚   β”œβ”€β”€ src/               # Source code
β”‚   β”‚   β”œβ”€β”€ app/           # App router pages
β”‚   β”‚   β”‚   └── dashboard/ # Dashboard page
β”‚   β”‚   β”œβ”€β”€ components/    # Reusable components
β”‚   β”‚   └── services/      # API service layer
β”‚   β”œβ”€β”€ public/            # Static assets
β”‚   └── ...                # Configuration files
β”œβ”€β”€ backend/               # FastAPI backend application
β”‚   β”œβ”€β”€ app/               # Application source code
β”‚   β”‚   β”œβ”€β”€ api/           # API routes
β”‚   β”‚   β”‚   └── v1/        # API version 1
β”‚   β”‚   β”œβ”€β”€ core/          # Core utilities and configurations
β”‚   β”‚   β”œβ”€β”€ models/        # Database models
β”‚   β”‚   β”œβ”€β”€ schemas/       # Pydantic schemas
β”‚   β”‚   └── database/      # Database configuration
β”‚   β”œβ”€β”€ main.py            # FastAPI application entry point
β”‚   └── requirements.txt   # Python dependencies
β”œβ”€β”€ docker-compose.yml     # Docker Compose configuration
└── README.md              # This file
```

## Development Guidelines

### Backend Development

1. Follow the existing patterns for adding new models, schemas, and API endpoints
2. All new endpoints should be added in the appropriate files under `app/api/v1/`
3. Database models should be added in `app/models/`
4. Pydantic schemas should be added in `app/schemas/`

### Frontend Development

1. Follow Next.js best practices
2. Use Tailwind CSS for styling
3. Component structure should follow the existing patterns

## Testing

(To be implemented)

## Deployment

(To be implemented)