GithubHelp home page GithubHelp logo

goncalo-marques / ecomap Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 7.5 MB

Solution for efficient waste collection and management.

Home Page: https://server-7fzc7ivuwa-ew.a.run.app

HTML 0.54% Svelte 28.83% CSS 0.84% TypeScript 8.72% JavaScript 0.10% Kotlin 5.67% Makefile 0.46% Dockerfile 0.11% Go 53.32% PLpgSQL 1.41%
management mobile waste-collection back-office

ecomap's Introduction

EcoMap

TODO

Development

The following section focuses on the development part of the project, including prerequisites, how to build and run the code, and how to contribute.

Table of Contents

Prerequisites

Web App

The web application runs on Node.js version 20.

Install the dependencies inside the web directory with:

npm install

Server App

The server application is written in Go and uses the version 1.22.

Docker

To run the application in containers, the Docker Engine is expected to be installed.

Android App

The Android application targets Android SDK 34.

Install Android Studio before you start contributing to the Android project.

Applications

Quick Start

In the project root directory, there is a Makefile that contains some targets to help develop and build the web and server applications.

Build and run both applications in a Docker container:

make up

Or, if the goal is to run each application independently, see the following steps.

  1. Start the web application in a development context:

    make dev-web
  2. Update the server configuration file, especially regarding the database connection string

  3. Start the server application in a development context:

    make dev-server

Web App

The web application can be found in the web directory. It uses Svelte.

The web application contains several scripts to lint, build and run the project. To check the available scripts, run the following command inside the web directory:

npm run

Server App

The server application can be found in the server directory. It contains the Go code that serves the following routes:

Route Description
/ Web Application
/api Rest API
/api/docs/ui Swagger UI

The server contains a Makefile that defines a set of tasks that can be run to help with development. The available targets can be checked by running the following command inside the server directory:

make help

To serve the web application, the server expects the web static files to be in the dist/web directory.

The Rest API is documented in a Swagger Specification file (ecomap.yml) in the api/swagger directory. This file is also used by the server to generate the API models and server boilerplate code to handle the HTTP API (see the generate-oapi Makefile target).

Inside the api/swagger directory, there is also a ui folder that contains the Swagger UI that is served by the server to present the Rest API documentation. See the README.md file in api/swagger for more information.

The server application requires a PostgreSQL database to manipulate the persistent data. There is a Docker Compose file (docker-compose.yml) in the project root directory that already contains a database service that can be run locally.

The database migrations can be found in database/migrations in the server directory. When the server starts, it will make sure that the database is running the configured migration version. This behavior can also be configured and disabled if necessary.

Note that there is a configuration file in the server directory that contains some placeholder variables that allow the server to be configured. By default, the server reads the config.yml file, but this can be overridden by setting the CONFIG_FILE environment variable with a path to a valid configuration file in any other directory.

Android App

The Android application can be found in the android directory.

Use gradlew to lint, build and run the project from the command line.

The Android application uses the Google Maps SDK for Android. Create a secrets.properties file in the android directory with the following content:

MAPS_API_KEY=<REPLACE_WITH_YOUR_API_KEY>

Contributing

Branches

  • The main branch contains the production code
  • To develop a new feature or fix a bug, a new branch should be created based on the main branch

Issues

  • The features and bugs should exist as a GitHub issue with an appropriate description
  • The status of the issues can be seen in the associated GitHub project

Commits

Pull Requests

  • To merge the code into production, a pull request should be opened following the existing template to describe it, as well as the appropriate labels
  • To merge the pull request, the code must pass all GitHub action checks, be approved by at least one of the code owners, and be squashed and merged

Deployments

  • After the code is merged into the main branch, there is a GitHub action that automatically builds and deploys the code to production

Releases

ecomap's People

Contributors

goncalo-marques avatar joaotomaspinheiro avatar goncalojdias avatar

Watchers

 avatar

ecomap's Issues

Define Container HTTP API

Define the following endpoints to manage a container:

HTTP Verb Endpoint Description
POST /containers Create a container
GET /containers List multiple containers
GET /containers/{id} Get a container
PATCH /containers/{id} Modify a container
DELETE /containers/{id} Delete a container

Display user location

Refs: Figma

  • Request GPS permissions
  • Display user location on the map
  • Add button to center map to user location

Report problem with a bin

Refs: Figma

Server

  • Store users reports

Android

  • Add user's reports page
  • Add report problem button
  • Add report problem page
    • Add small map to display the bin location
    • Add buttons for selecting the type of problem(s)
      • Full
      • Vandalized
      • Misplaced
      • Non-existent
      • Other
    • Add free form description (optional)
    • Add image/video attachment (optional)
    • Add send button

Create web app base layout

Create the basic layout of the web app home page. The layout contains the top bar, the side bar, and the content associated with the selected menu.

Refs: Figma

Add login

Refs: Figma

  • Add login page
  • Add registration page
  • Authentication with JWT token

Set up cspell

cspell is a command line tool and library for spell checking code.

It's required to set up an action that checks for spelling errors before merging pull requests.

Add employee sign in endpoint

  • Create HTTP endpoint to handle sign in:
    • Request body:
      • username
      • password
    • Response body:
      • JWT
  • Compare given password with the one stored in the database using bcrypt

Add user sign in endpoint

  • Create HTTP endpoint to handle sign in:
    • Request body:
      • username
      • password
    • Response body:
      • JWT
  • Compare given password with the one stored in the database using bcrypt

Nearest bin

Refs: Figma

Add button to select the nearest bin. The nearest bin is determined by the current user position and the selected filters.

Define User HTTP API

Define the following endpoints to manage a user:

HTTP Verb Endpoint Description
POST /users Create a user
GET /users List multiple users
GET /users/{id} Get a user
PATCH /users/{id} Modify a user
DELETE /users/{id} Delete a user
PUT /users/password Modify a user password
PUT /users/reset-password Reset a user password

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.