Skip to content

EcoBeko/docs

Repository files navigation

EcoBeko's Documentation 💬

Documentation is powered by Docsify, therefore main README file is located here but it's preferable to access the generated docs since all the linking (images, sources) is done for generated version only, here's the link: eco-beko.ryspekov.life/docs.

If you prefer to access everything in one page, this README is about it.

Table of contents:

Phase 2

Project Description 📓

EcoBeko is a eco-activists oriented social network, where in addition to an ordinary online social interactions features, new ones are added!

Our goal is to build a social network with eco-specific features that could unite people, help contacting big organizations and just knowing about all the helpful activities that people around the world could share with simple articles.

This app could potentially help the beginners that want to start help the planet. There are multiple ways of doing that: thoughtful consuming, collecting/sorting trash, planting trees, helping animals, engineering agricultural lands and etc. However, there is so much people can do wrong about everything, therefore, having organizations or experienced people just writing about their day-to-day routines in addition to articles that may demystify some conspiracies.

Scope 🧐

What we want to achieve is a fully functional, standalone web application and database that could scale and handle things nicely.

We have tried to build EcoBeko before (old repositories are now archived), however we were able to have only authorization/registration with News feed, user trash recycling statistics and map containing recycling points in Almaty. Being more experienced with building stuff, we are able now to finish much more modules here.

General features/modules the system covers:

  • User registration/authorization
  • User profile module
  • News module
  • Ability to write posts
  • Ability to write articles
  • Friends module
  • Recycling maps module
  • User/Global statistics
  • Eco Projects module
  • Communities module

Tech Stack & Tools ⚙️

The architecture is available here

We will be building a simple client-server architecture, but there are some details.

Frontend

As a UI, we choose to build a web application with Vue.js. We have some experience building such systems, so having web application is almost a standard. On the other side, web is growing big now.

Backend

REST API is the common way to go, in terms of building apps as SPA's. Having single language to work with is an advantage, so Node.js is an obvious choice. In order to leverage TypeScript features and to have the ability to quickly write scalable/modular API, NestJS is our choice.

Database

Postgres SQL is one of the most popular SQL database. It's Open Source nature brings a community, that any project definitely wants. Postgres is known to be a highly fault-tolerant and while comparing to the other SQL solutions, it's easy to setup and get start with.

REST API reference 👷

API docs will be build with Swagger and will be available at /api endpoint

Phase 3

Authorization/Registration module

  1. How the system will differentiate the users, give a proper access to a certain functionalities?

The answer: by giving the users the ability to register and then authenticate themselves in our system:

authorization-registration

News module

  1. The main reason for users to register in our system is to share or acquire the experiences across the world. How they will be able to do so?

The answer: users will be able to write regular posts in our system and share them with their friends.

write-posts

  1. Learning through experiences is a good way to go, however, sometimes writing just posts is not good enough as the idea of posts is similar to Twitter's tweets, little, short stories. How professionals of different degree could share stories/materials in more structured way?

The answer: users will be able to write articles in medium manner.

write-articles

Friends module

  1. How do people will share the posts or articles when there's no one to read them?

The answer: users will be able to search for friends using multiple filter parameters.

searching-friends

  1. Searching for all the closest friends you got could turn out to be pretty complicated task, how users could find friends more easily?

The answer: recommendation system based on users friends could help find their other friends too.

recommendation-list

Statistics module

  1. Eco-friendly users often are responsible consumers or at least trying to. Sometimes, the motivation behind sorting trash is unknown, how the system will be able to motivate users to continue sorting?

The answer: visuals and strong numbers could trick our brain to understand the reason behind his actions. The system will provide a proper statistics in terms of amount of saved trees and energy also keeping track of how much KG is collected by individual user or globally.

update-statistics

Messages module

  1. What other ways of user activities the system could present in order to communicate with friends (beside posts and articles)?

The answer: messages module will provide a real-time way of connecting with any friend.

write-messages

  1. What if users will want to discuss something quick with 3 or more people instead of writing to each person?

The answer: group chats.

!> Use-case for group chats are the same, but scales with multiple users

Communities module

  1. Having a big pool of users is great, but as different people are having different eco topics that they want to cover, is there a more organized way of collecting the ideas into a single place?

The answer: subscribing to communities.

subscribe-to-community

  1. Having communities is great, but if single user is unable to find a community of his own thoughts and ideas, what should he do?

The answer: create and administrate his own community.

add-community

  1. As communities are growing in size, it becomes difficult to administrate them singlehandedly, how the users are supposed to scale the community?

The answer: users could ask friends to become the moderator of their group, so they can perform different tasks such as editing/creating in their communities.

add-community-moderator

Map module

  1. While wanting to sort trash, it is essential to have a place to send your trash to, so that it will be utilized. How users will be able to find such places?

The answer: users could use the eco map the system provides and search for a proper place in their city.

view-map

  1. There could be a bug number of recycling points across the city, how to find the proper one? (to be sure that a place can accept a certain material)

The answer: the eco map provides a way to filter places according to materials they want.

view-map-filtered

Eco Projects module

  1. There are so much is happening around the globe: eco moves, projects, activities and etc. How potentially interested people could know where or when such events are happening?

The answer: special users are able to keep track of such events and publish them in events feed.

view-eco-projects

Administration module

  1. Having at least one special kind of users (that are able to publish events), how are they being created?

The answer: another special user type with admin role (which is created by hand) is able to access admin console and perform such a task.

administrate-moderators

Datasets

Datasets were generated after Phase 4 and are available here:

We will generate more datasets later

Phase 4

Schema

schema

Description

General info

Enum fields are represented as a small collection of values. Image/Link fields are foreign keys to the Resources Table. Any field marked with asterisk is an indexed field.

Resources table

Resources table is responsible for containing image/link paths. This will be useful across an application, since using entity_id (entity is any table using resources) will resolve an image directly without fetching entity itself. Mostly, we thought of practicing such tables of metadata.

Users table

Users table contains user info, their credentials and some metadata (status, role). Usernames are unique, and passwords are hashed using bcrypt. As for deleting users, we won't delete them directly, instead, to ease maintaining lost id references we will mark disabled users with status=disabled

Friends table

Friends table contains users' relations, user_id will be used to fetch user's list of friends. In order to make it work, single friendship creates 2 rows, where user_id and friend_id will be switched

Chats (chats, user_chats, messages tables)

For any chat that has begun to work (user chat, group chat) one row in chat table is created. user_chats is responsible for mapping user_id to a chat_id (single user could have multiple chats), and stating user's role in a chat. In that way, user and group chats are stored in a same relations. Messages are produced by users and binds to a certain chat.

Recycling points (recycling_points, recycling_point_accepts, waste_types tables)

Recycling points table contains information about utilization/recycling points in Almaty and Nur-Sultan cities. There could be many waste types stored in the system, from which recycle points need a bridge table which maps them with waste types (single recycling point accepts multiple waste types). Recycling point can pay for a certain waste type or pay nothing at all.

Eco projects table

Eco project table is responsible for announcing eco projects around the globe, it contains just enough information for users to be familiar with.

Statistics (stats_records, stats_types, stats_type_maps, waste_types tables)

Users are able to write statistics about their sorting (Which waste type? How many kilos?), stats_records holds such info. There are many statistical types, for instance, all the sorted trash could be summarized in terms of how much trees are saved, how much energy is saved and etc, stats_types are used for that. Each stat. type is growing from a specific waste_types, stats_type_maps shows which waste types are contributing to which stats types. For instance, 1kg plastic is a 0.1 kWh energy saved, which means a coefficient stored in mapping is 0.1.

Communities (communities, subscriptions tables)

It's simple, users are able to create a community, and other users can subscribe. Admin can assign moderators to a community which could do everything admin can, except deleting community.

Posts (posts, comments tables)

Users are able to write posts or articles, which are stored in a json format. Author could be a user or community which could be evaluated in a procedure.

Phase 5

Queries are available here:

Phase 6

Application link: https://eco-beko.ryspekov.life/app Rest API reference: https://eco-beko.ryspekov.life/api PG Admin console: http://eco-beko.ryspekov.life:5480/browser/

Complex queries for future phases

They are wrapped inside functions for parameter usage, calculations will be done using queries themselves

  1. f_get_community
  2. f_get_users_stats
  3. f_get_subs
  4. f_get_user_feed
  5. f_get_top_community_users
  6. f_get_top_waste_types
  7. f_get_top_impactful_users

Phase 7

Phase 8

Phase 9

Measurements are contained in the same files

Phase 10

Our final report is available here

Our final presentation is available here

About

Documentation part for our course project

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •