20
FS Blog #5: Social Poster - My JavaScript Project
For my JavaScript project, I'm building Social Poster, a web application and social platform that let users create, edit, and delete posts, as well as like and save posts. Users can create, edit/update, and view their posts, as well as view, and edit other user's posts. They would also be able to see all community posts and view all posts by category.
This project uses Rails API for the backend, and JavaScript for the frontend. This was a natural progression from the last Rails project, where we used Rails views/.erb files only for rendering. This feels even more like a real world application, where JavaScript is often used for building the frontend of a web application.
Before I started building the app, I first wrote out the user story and designed the model/class relationships: my app was simple, I had two models, Post and Category. The category has_many posts, and post belongs_to category. The category has attributes like category name and category description, and the post has attributes like title, content, media url, and category.
After drawing out a flow chart for the app, I then start setting up the app environment and structure. As a part of the project requirement, I'm using Rails API for the app's backend, and JavaScript (and HTM & CSS) for the frontend.
- rails new js-social-poster-api —api - this command creates the project with rails API (not the full rails).
- rails g resource - this command generates the project file structure, including the controllers, models, migration files, views, etc.
- Ruby
- Rails
- JavaScript
- HTML
- CSS
- Debugger
- Sqlite3
- Puma
- Bootsnap
- Rack-cors
- Faker
Coming from Ruby, Sinatra, and Rails, diving into JavaScript felt very different. There were a lot of similarities between Ruby and JavaScript (or between programming languages in general), but there were a lot of differences as well. As a part of the project requirement, in addition to cover the project requirements, I tried to use as many concepts as I learned about JavaScript in the app, while still keeping the app as a very simple MVP.
Concepts I used: