dwrdvncntcvs / galleria-server

Galleria is social media application project where users could post images and texts to share with other people that have an account on the application. The application also has followers and following where it limits the posts that the users will see on their feed. This project was written from scratch using JavaScript, NodeJS, Sequelize, Express, Firebase, and other libraries. I used Firebase Storage to store files on the cloud instead of storing locally. The purpose of this application is for learning new practices, technologies, and techniques on creating social media applications. The project doesn't use any external APIs to fetch data and serve to the user. The application will only depend on the data that's coming to it.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Galleria API

Galleria is social media application project where users could post images and texts to share with other people that have an account on the application. The application also has followers and following where it limits the posts that the users will see on their feed.

This project was written from scratch using JavaScript, NodeJS, Sequelize, Express, Firebase, and other libraries. I used Firebase Storage to store files on the cloud instead of storing locally. The purpose of this application is for learning new practices, technologies, and techniques on creating social media applications. The project doesn't use any external APIs to fetch data and serve to the user. The application will only depend on the data that's coming to it.

Installation

  • Be sure to have NodeJs installed on your local machine.

  • Clone the repository to your local machine.

    git clone https://github.com/dwrdvncntcvs/galleria-server.git
  • Open the directory on your terminal and run the following commands:

    npm install

    or

    yarn
  • Create a environment file on the src directory.

    touch .env
  • Copy and paste these variables inside your .env file:

    • For the database configuration, it will depend on the database installed on your local machine. For this project, it is advised that you use PostgreSQL as the dependencies that support this database were already installed.

       //Database
       DATABASE_USERNAME=
       DATABASE_PASSWORD=
       DATABASE_HOST=
       DATABASE_NAME=
       DATABASE_DIALECT=
    • Access token and refresh token secret where manually generated using md5 hashing. On this website you could generate your own secret tokens.

      //Secret Tokens
      ACCESS_TOKEN_SECRET=
      REFRESH_TOKEN_SECRET=
      OTP_TOKEN_SECRET=
    • To create firebase own configuration, you can use this Firebase documentation as reference. You can also create a project at the Firebase website and copy the configuration.

      //Firebase
      FIRE_API_KEY=
      FIRE_AUTH_DOMAIN=
      FIRE_PROJECT_ID=
      FIRE_STORAGE_BUCKET=
      FIRE_MESSAGING_SENDER_ID=
      FIRE_APP_ID=

      Note : If you were creating a project on your firebase, create a storage on the project immediately.

      Note: If you want to use my firebase storage, just email me.

    • As the application has it's own mailing service, you must generate your client ID and secret from Google Developer's Console. You will also need to generate refresh token from Google Developer Auth Playground.

      //Mailing
      GOOGLE_CLIENT_ID=
      GOOGLE_CLIENT_SECRET=
      GOOGLE_REDIRECT_URI=
      GOOGLE_REFRESH_TOKEN=
      GOOGLE_USER=
      GOOGLE_PASSWORD=
    • This is for the application's storing of files. Currently the application is only storing files on memory before uploading it to Firebase, however, I will going to make the application to store files within on it's root directory that's why I already have this option.

      //Storage
      M_S_TYPE = memory;

Note : These are the environment variables that I used for the project. Before running the application on your local machine, please be advised that all of these are very important variables and should be configured accordingly.

  • Assuming that you are using NPM, to start the application, run these commands in the terminal:

    To create database.

    npm run create

    To migrate models.

    npm run migrate

    To start the application

    npm run start

    Note: If there's any error that you are facing on running these commands, please check carefully your environment variables related to the database.

  • Optional Commands:

    To undo previews migration.

    npm run undo

    To undo all migrations.

     npm run undo:all

    To create new model.

    npm run model -- -name ... -attributes ...

Galleria's RESTFul API

This is the backend application of Galleria where it will be deployed on server side. The application is written in JavaScript with its run-time environment NodeJs. The application was created using ExpressJS which is a nodejs web framework and could be used for creating RESTful APIs. The database used was PostgreSQL during development but could be altered because I have used Sequelize which is a ORM or Object-Relational Mapping. It allows me to easily create models and migrate it to the database without using SQL queries manually. The application also maximize the use of google services such as firebase and gmail. Firebase were used to serve as storage for images and files that will be uploaded within the application as it still doesn't support uploading files and saving directly on its own server as it could cause issues within the file once it is deployed. The application has its own mailer that I have created using Nodemailer. I used Oauth2 of google to allow my application send emails using the google account that I created.

This application is only the backend fo Galleria. It was built as my personal project to enhance and improve my understand and knowledge on building backend application using NodeJs and other libraries. I also want to create my own "Social Media" application where users will be able to post what they want like pictures, videos, texts and share their thoughts to their friends, co-workers, acquaintances, classmates, and other people that surround them.

Note: I'm not a professional developer but I do want to become one someday. I see that this is a great start.

All rights reserved | Galleria 2022

About

Galleria is social media application project where users could post images and texts to share with other people that have an account on the application. The application also has followers and following where it limits the posts that the users will see on their feed. This project was written from scratch using JavaScript, NodeJS, Sequelize, Express, Firebase, and other libraries. I used Firebase Storage to store files on the cloud instead of storing locally. The purpose of this application is for learning new practices, technologies, and techniques on creating social media applications. The project doesn't use any external APIs to fetch data and serve to the user. The application will only depend on the data that's coming to it.


Languages

Language:JavaScript 100.0%Language:Procfile 0.0%