|
1 |
| -This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). |
| 1 | +# Website |
| 2 | + |
| 3 | +Welcome to the Website repository, part of the AirQo Frontend project. This website is built with [Next.js](https://nextjs.org) and was bootstrapped using [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). The live website can be found at [airqo.net](https://airqo.net). |
| 4 | + |
| 5 | +> **Note:** This repository only contains the frontend portion of the project. The backend has been built with Django and is maintained in the [airqo-api](https://github.com/airqo-platform/airqo-api) repository. If you wish to use the database for the website, please contact the project admin to obtain the necessary database URL for the frontend configuration. |
| 6 | +
|
| 7 | +This guide provides clear, step-by-step instructions to help you set up your local development environment, run the website, and contribute effectively. Additionally, it explains how to handle environment variables and update CI/CD workflows. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## Table of Contents |
| 12 | + |
| 13 | +- [Website](#website) |
| 14 | + - [Table of Contents](#table-of-contents) |
| 15 | + - [Getting Started](#getting-started) |
| 16 | + - [1. Clone the Repository](#1-clone-the-repository) |
| 17 | + - [2. Navigate to the Website Folder](#2-navigate-to-the-website-folder) |
| 18 | + - [3. Install Dependencies](#3-install-dependencies) |
| 19 | + - [4. Run the Development Server](#4-run-the-development-server) |
| 20 | + - [Environment Variables \& Workflow Updates](#environment-variables--workflow-updates) |
| 21 | + - [Backend \& Database Integration](#backend--database-integration) |
| 22 | + - [Contributing](#contributing) |
| 23 | + - [Learn More](#learn-more) |
| 24 | + - [Deployment](#deployment) |
| 25 | + |
| 26 | +--- |
2 | 27 |
|
3 | 28 | ## Getting Started
|
4 | 29 |
|
5 |
| -First, run the development server: |
| 30 | +Follow these steps to set up your local development environment for the website. These instructions are applicable on Windows, Mac, and Linux. |
| 31 | + |
| 32 | +### 1. Clone the Repository |
| 33 | + |
| 34 | +Clone the AirQo Frontend repository using the following command: |
| 35 | + |
| 36 | +```bash |
| 37 | +git clone https://github.com/airqo-platform/AirQo-frontend.git |
| 38 | +``` |
| 39 | + |
| 40 | +_Tip for Mac/Linux:_ |
| 41 | +If you encounter any permission issues with Git, ensure that Git is correctly installed on your system. You can install Git via [Homebrew](https://brew.sh) on Mac (`brew install git`) or use your package manager on Linux (e.g., `sudo apt-get install git` on Debian/Ubuntu). |
| 42 | + |
| 43 | +### 2. Navigate to the Website Folder |
| 44 | + |
| 45 | +After cloning the repository, navigate to the folder that contains the website application: |
| 46 | + |
| 47 | +```bash |
| 48 | +cd AirQo-frontend/src/website2 |
| 49 | +``` |
| 50 | + |
| 51 | +_Note:_ |
| 52 | +The folder structure is consistent across all operating systems. Use your terminal (Mac/Linux) or Command Prompt/PowerShell (Windows) to run this command. |
| 53 | + |
| 54 | +### 3. Install Dependencies |
| 55 | + |
| 56 | +This project requires **Node.js version 18 or above**. Ensure you have Node.js and npm installed on your system by running: |
| 57 | + |
| 58 | +```bash |
| 59 | +node -v |
| 60 | +npm -v |
| 61 | +``` |
| 62 | + |
| 63 | +If you need to install or update Node.js, download it from [nodejs.org](https://nodejs.org/) or use a version manager like [nvm](https://github.com/nvm-sh/nvm) (especially useful for Mac/Linux). |
| 64 | + |
| 65 | +To install the required dependencies using **npm**, run: |
| 66 | + |
| 67 | +```bash |
| 68 | +npm install |
| 69 | +``` |
| 70 | + |
| 71 | +_For Mac/Linux Users:_ |
| 72 | +If you experience permission issues while installing packages globally, consider using a Node version manager like [nvm](https://github.com/nvm-sh/nvm). |
| 73 | + |
| 74 | +### 4. Run the Development Server |
| 75 | + |
| 76 | +Launch the development server with the following command: |
6 | 77 |
|
7 | 78 | ```bash
|
8 | 79 | npm run dev
|
9 |
| -# or |
10 |
| -yarn dev |
11 |
| -# or |
12 |
| -pnpm dev |
13 |
| -# or |
14 |
| -bun dev |
15 | 80 | ```
|
16 | 81 |
|
17 |
| -test |
| 82 | +Once the server starts, open [http://localhost:3000](http://localhost:3000) in your browser to view the website. The page will automatically reload as you make changes. |
| 83 | + |
| 84 | +_Alternate Tips for Mac/Linux:_ |
| 85 | + |
| 86 | +- Use your terminal’s tab completion to quickly navigate directories. |
| 87 | +- If you’re using a firewall or proxy, ensure your local ports are accessible. |
| 88 | + |
| 89 | +--- |
| 90 | + |
| 91 | +## Environment Variables & Workflow Updates |
| 92 | + |
| 93 | +When adding new environment variables to the project, ensure that the CI/CD workflows remain consistent across staging, production, and preview environments. |
| 94 | + |
| 95 | +For example, if you add new variables, update your workflow YAML files as follows: |
| 96 | + |
| 97 | +```bash |
| 98 | +echo " NEXT_PUBLIC_OPENCAGE_API_KEY: ${{ secrets.WEBSITE_NEXT_PUBLIC_OPENCAGE_API_KEY }}" >> .env.yaml |
| 99 | +echo " NEXT_PUBLIC_API_TOKEN: ${{ secrets.WEBSITE_PROD_NEXT_PUBLIC_API_TOKEN }}" >> .env.yaml |
| 100 | +``` |
| 101 | + |
| 102 | +**Important Notes:** |
| 103 | + |
| 104 | +- Verify that the secret names used in your workflows match those defined in your repository. |
| 105 | +- If you add new environment variables, please contact the project admin to have them added to the GitHub secrets. |
| 106 | +- Always update the workflow files whenever you introduce or modify environment variables. |
| 107 | +- You can find the workflow files for the different environments in the `.github/workflows` folder. |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +## Backend & Database Integration |
| 112 | + |
| 113 | +The backend for this project is built with Django and is maintained in the [airqo-api](https://github.com/airqo-platform/airqo-api) repository. If you wish to connect the website to a live database: |
| 114 | + |
| 115 | +- **Database Access:** |
| 116 | + You will need the database URL which is not publicly available. |
| 117 | + **Action Required:** Contact the project admin to obtain the database URL for frontend integration. |
| 118 | + |
| 119 | +- **Environment Variables:** |
| 120 | + Once you receive the database URL, update your environment variables accordingly in the `.env.yaml` file and any other relevant configuration files. |
| 121 | + |
| 122 | +--- |
| 123 | + |
| 124 | +## Contributing |
| 125 | + |
| 126 | +We welcome contributions from the open source community. To help you get started, please follow these steps: |
| 127 | + |
| 128 | +1. **Fork and Clone:** |
| 129 | + |
| 130 | + - Fork the repository on GitHub. |
| 131 | + - Clone your fork to your local machine: |
| 132 | + ```bash |
| 133 | + git clone https://github.com/your-username/AirQo-frontend.git |
| 134 | + ``` |
| 135 | + |
| 136 | +2. **Create a Branch:** |
| 137 | + |
| 138 | + - Create a feature or bug-fix branch: |
| 139 | + ```bash |
| 140 | + git checkout -b feature/your-feature-name |
| 141 | + ``` |
| 142 | + |
| 143 | +3. **Make Your Changes:** |
| 144 | + |
| 145 | + - Follow the coding standards and guidelines established in the project. |
| 146 | + - Update documentation as needed. |
| 147 | + - Test your changes locally to ensure everything works as expected. |
| 148 | + |
| 149 | +4. **Commit and Push:** |
| 150 | + |
| 151 | + - Commit your changes with a clear commit message: |
| 152 | + ```bash |
| 153 | + git commit -m "Description of your changes" |
| 154 | + ``` |
| 155 | + - Push your branch to your fork: |
| 156 | + ```bash |
| 157 | + git push origin feature/your-feature-name |
| 158 | + ``` |
| 159 | + |
| 160 | +5. **Open a Pull Request:** |
| 161 | + - Navigate to the main repository on GitHub and open a Pull Request against the `main` branch. |
| 162 | + - Provide a detailed description of your changes and reference any related issues. |
18 | 163 |
|
19 |
| -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. |
| 164 | +--- |
20 | 165 |
|
21 |
| -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. |
| 166 | +## Learn More |
22 | 167 |
|
23 |
| -This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. |
| 168 | +To expand your knowledge about Next.js and modern web development, consider exploring these resources: |
24 | 169 |
|
25 |
| -## Learn More. |
| 170 | +- **[Next.js Documentation](https://nextjs.org/docs)** – Learn about Next.js features and APIs. |
| 171 | +- **[Learn Next.js](https://nextjs.org/learn)** – An interactive tutorial for building Next.js applications. |
| 172 | +- **[Next.js GitHub Repository](https://github.com/vercel/next.js)** – Explore and contribute to the core Next.js codebase. |
26 | 173 |
|
27 |
| -To learn more about Next.js, take a look at the following resources: |
| 174 | +--- |
28 | 175 |
|
29 |
| -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. |
30 |
| -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. |
| 176 | +## Deployment |
31 | 177 |
|
32 |
| -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! |
| 178 | +The simplest way to deploy the website is via the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme). For more detailed deployment instructions, refer to the [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying). |
33 | 179 |
|
34 |
| -## Deploy on Vercel |
| 180 | +--- |
35 | 181 |
|
36 |
| -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. |
| 182 | +Thank you for your interest in contributing to our website. Your support and contributions are vital to the ongoing success and improvement of the project! |
37 | 183 |
|
38 |
| -Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. |
| 184 | +--- |
0 commit comments