Code Monkey home page Code Monkey logo

aadeshkulkarni / figuringout Goto Github PK

View Code? Open in Web Editor NEW
88.0 2.0 91.0 597 KB

Blogging + Social Media + AI | Opensource | Javascript | ReactJS | HonoJS | Prisma

Home Page: https://figuringout.life

License: MIT License

TypeScript 95.89% JavaScript 1.66% HTML 0.85% CSS 1.28% Dockerfile 0.31%
blog cloudfare-workers honojs javascript npm-library reactjs zod blogging nodejs opensource generative-ai good-first-issue open-source tailwindcss social-media typescript

figuringout's Introduction

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

Figuringout.Life

A Fullstack Javascript blog with Generative AI!
Explore the docs »

View App · Report Bug · Request Feature

About The Project

Screenshot 2024-06-02 at 6 32 27 AM

A React frontend and Cloudflare workers backend application offering features that replicate Medium, the popular blogging platform.

Features:

  • Token based Authentication.
  • Create, Read, Update, Delete Blogs.
  • Bookmark, Like, Search, Filter Blogs.
  • Autosave blog while writing.
  • User profiles.
  • Topics.
  • Subscribe profiles.
  • Comment.

Unique Features:

  • Generate Blog using AI.
  • Chat with AI to deepen your understanding around a particular blog.
  • Voice over for blogs, so you can listen to blogs while working out / having food.

(back to top)

Technologies & Libraries

React Cloudflare Zod Typescript Prisma Postgres

(back to top)

Project Structure

  • Backend: Contains server-side code and logic.
  • Common: Shared assets and modules used by frontend and backend. (NPM Library)
  • Frontend: Contains client-side code and logic.

Local Setup

Backend

Pre-requisities:
  • Create a copy of .env.example and name the file .env
  • Set up Postgres DATABASE_URL in .env file. You can get a free PostgreSQL connection string from Aiven.io.
  • Create a copy of wrangler.sample.toml and name the file warngler.toml
  • Set up Prisma connection pool DATABASE_URL in wrangler.toml file. You can get this for free from Prisma.
  • Set up JWT Secret JWT_SECRET in wrangler.toml file. This can be any value.
  • Login to (cloudflare) and create a new R2 bucket. You probably need a Credit card for verfication.
  • Allow Access for R2.dev subdomain for your R2 bucket from R2>settings.
  • Replace Bucket-name and preview-your-bucket-name with your R2-bucket-name in wrangler.toml file.
  • Replace R2_SUBDOMAIN_URL with your R2 subdomain URL in wrangler.toml file.
cd backend
npm install
npm run prisma:migrate
npx prisma generate
npm run dev

Note: wrangler.toml is the environment configuration file for a serverless backend. .env is used by Prisma for connection pooling. Ensure you configure both environment files accordingly.

Frontend

  • Navigate into the frontend directory using
cd frontend
npm install
npm run dev

Note: frontend/src/config.ts contains BACKEND_URL. If you need your frontend to point to local backend server, uncomment export const BACKEND_URL = "http://localhost:8787".

Running Frontend and Backend Concurrently

To make the developer experience smoother, you can now run both the frontend and backend simultaneously using a single command from the project root.

Steps:
  • Ensure you have project root folder. install packages with
    npm install
  • Insall both frontend and backend pakages with
    npm install:all
  • Now you can simply run:
    npm run dev
    This command will start both the frontend and backend servers simultaneously.

For additional customization options and detailed information, please refer to the concurrently documentation.

AI based Article content generation

  • set FF_ENABLE_AI = true in config.ts
  • set OPENAI_API_KEY in wrangler.toml file in the backend. (https://platform.openai.com/api-keys)
  • The feature is enabled only when title is atleast 10 characters long.

Contributing

We welcome contributions from the community! To contribute, follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/[feature-title]).
  3. Make your changes and commit them (git commit -am 'Add brief meaningful commit message').
  4. Push to the branch (git push origin feature/[feature-title]).
  5. Create a new Pull Request.

For major changes, please open an issue first to discuss what you would like to change.

Read our contribution guidelines for more details.

🤝 Contributors

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Aadesh Kulkarni - [email protected]

Project Link: https://github.com/aadeshkulkarni/medium-app

Discord: https://discord.gg/JtTQkzFY89

(back to top)

figuringout's People

Contributors

aadeshkulkarni avatar jyo142 avatar shubbhhh avatar krupapanchal2527 avatar dhairya-create avatar vverma022 avatar vlokesh08 avatar rahul-mahato29 avatar harshs1611 avatar karanpatel1993 avatar swastik4805 avatar rahulsingh9131 avatar jaishree2310 avatar ankit1478 avatar 0xprathamesh avatar debopriyobasu avatar prithvi-r avatar ashutoshpadhi629 avatar atharvachobe avatar m0hitreddy avatar sandipgyawali avatar shashan17j avatar malla-lokesh avatar vijaynvvr avatar gourav094 avatar bruno-corso avatar abidta avatar ramnaresh8 avatar moiam avatar masoudhsd avatar

Stargazers

tulasiram kancharla avatar ALI avatar Larry Chan avatar Sunny Patel avatar Taqi avatar Aswinkumar AR avatar Pratham Dupare avatar Ali Yar Khan avatar Jayant avatar uanik avatar Yusuf avatar Samrat Malisetti avatar Adarsh Mishra avatar Rohan Kute avatar Ashish Kumawat avatar  avatar Mohit Yadav avatar  avatar Rohan Vaidya avatar Karthik Joshi avatar  avatar Anubhav Sharma avatar Siddharth Talesara avatar Tamal Chakraborty avatar Abhishek Raj avatar Divyansh Agrawal avatar Chetan avatar CH MAHESH avatar karan sharma  avatar  avatar Bhuvansh Goyal avatar  avatar Domenico Tenace avatar  avatar pavan kumar  avatar saki1994 avatar Zeel Patel avatar  avatar Dev Suthar avatar JACOB ZONG avatar Usama Khalid avatar Shubham lad avatar  avatar  avatar  avatar Can Huynh avatar  avatar Dimas Pramudya avatar Kunal Singh avatar Sparshh avatar Vikas avatar Harsh Chandwani avatar  avatar Pratheesh Balachandran avatar Akshit lakhera avatar Sagar reddy avatar Keshav Sinha avatar Anuj Bhati avatar sumanth avatar Sundaram Singh avatar Aaqil Yousuf avatar Shariq Shafi avatar Nishita Pande avatar Anirudh SJ avatar Pulkit Kakar avatar  avatar Ravindra Kumawat avatar pankaj avatar Vansh Goyal avatar  avatar Aman Raina avatar  avatar Pratik Bhavarthe avatar Gurdit Singh avatar Thalla Prudhvi Rao avatar Deepesh7987 avatar Manish Kumar Gupta  avatar Surjodeepta Saha avatar Abhilov Gupta avatar Priyabrata Sahu avatar vineeth Thungani avatar Saurabh Sharma avatar Pratik Kundnani avatar Jitto Joyes avatar  avatar  avatar Varsha Khatavani avatar Abhirup Pan avatar

Watchers

 avatar  avatar

figuringout's Issues

Feature | GET Tag endpoint

Create a protected endpoint GET /api/v1/tag which returns a list of tags from the database.

Some pointers to setup:

  • Tag table already exists in schema.prisma. Run npx prisma generate --no-engine for db migration on your local.
  • Seed your database with tags by running npm run db:seed (this will execute prisma/seed.ts script)

BUG : Redirect to Sign-In Page After Sign-Up

After signing up, users should be directly redirected to the blog page. However, the issue is that after signing up, users redirect to sign in page and again prompted to enter their email ID and password , which creates an irritating experience for them

Screenshot (665)
Screenshot (666)

Screenshot (667)

Bug | Sign up | Password Strength

Current:

When user visits the signup page, Password Strength: is displayed above the Sign Up button.

Screenshot 2024-05-20 at 9 09 02 PM

Expected:

The "password strength:" should be visible only after user starts typing the password.

Bug | Layout shift when Clap is clicked

Current

When user visits any article, and clicks on the clap button, the following things are observed on the UI

  • A loader appears that replaces the clap icon
  • After the loader vanishes, the clap icon again appears
  • After a while, when the API returns response, The clap icon re-appears and the clap count is changed on the UI causing layout shift of clap icon.

Expectation

When user clicks on the clap icon, the clapping should be more intuitive. The CLS issue causes a bad UX.

  • Instead of clapIcon > then loader > then clapIcon | Show only clapIcon
  • The shifting of icon when the count increases should not happen. (Always assume the count will take specific width, so that the clapIcon will not shift to the left when the count is painted on the screen)
  • Light-weight animation to indicate the user clapped might look good (this is optional and open to other ideas) [refer medium claps for more details]

Enhancement | Sort Articles by Date & claps

Current:

All articles listed in the /blogs page are unsorted and shown in the order they were originally created. That means, the newest article is at the bottom of the page and the oldest article is at the top of the page.

Expectation:

Articles with highest claps should be at the top AND order by creation-date in descending order (newest at the top)

Signup & Signin | Loader not visible when button is clicked

Scenario:
When user clicks on signup or sign in button, following issues are visible

  1. No loader shown, user is unsure if app is performing any action
  2. No alert shown in case of failure. User needs to be notified with what went wrong so that they can take corrective actions.

Homepage | Add a sign in button on the Appbar

Issue:
Currently, In-order to login, The user needs to make the following hops to reach the Sign in page:

  • Go to homepage, click on Start reading button (Redirects to signup page, if user is not logged in)
  • Go to Signup page, click on login anchor tag (Redirects to signin page)
    And now the user is finally able to see the Sign in screen

Expectations:
When user visits the app,
If user NOT loggedIn, then show a Sign In link on the Appbar which re-directs to sign in page.
If user logged, then don't show the Sign in link on the Appbar

Screenshot 2024-05-03 at 12 24 04 PM

Feature | My blogs

After logging in, when user clicks on user-icon (top right), they should see a 'My blogs' option in the dropdown menu.

When user clicks on my blogs, a new page should be shown with the list of all blogs that the user has created.

Feature | Show blogs even if user has not signed in.

Where ?

  • Homepage route "/"

What ?

  • On 'Start Reading' button click, redirect user to /blogs (even if user not logged) and show all blog list.
  • If user clicks on any specific blog, perform the following action

If user is logged in, then redirect to /blog/:id and show the full blog (Already implemented ✅)
If user is not logged in, then redirect to /signup (Dev needed ❌)

Feature | Display topic pills on the Blogcard

Current:

The /blogs frontend route shows a list of blogcard. Each blogcard looks like this:

Screenshot 2024-05-22 at 5 12 21 PM


Expectation:

Show topics / tags for each blogcard in the list.

Something like this:
Screenshot 2024-05-22 at 5 09 44 PM


Points to consider:

  • The /blog/bulk API endpoint already returns tags for each article like so:

Screenshot 2024-05-22 at 5 14 15 PM

  • Show min. 0 and max. any 2 topics ONLY (Even if an article is assigned more than 2 topics)
  • Each topic should be a pill (similar to the image shown above)
  • Consider responsiveness.

Feature | Profile page for user

Build a profile page like this

Screenshot 2024-04-27 at 8 05 24 AM

The profile should be accessible from the url like this

xyz.com/@username

Features:

  • User posts
  • User personal information (edit option)

Following and Followers is out of scope of this PR and can be ignored for now.

Implement Bookmark feature

When?

  • User is reading an article.

What?

  • User should be able to bookmark (Save for later) the article.
  • User should be able to view the bookmarked articles by clicking on the user avatar > bookmarks

Feature | Implement Social Share Preview for a blog link

Expectation:

When a user wants to share an article on their socials, the app should show a beautiful thumbnail / preview.

The preview should work everywhere, and but minimum following socials should be checked:

  • Whatsapp
  • Instagram
  • LinkedIn
  • Facebook
  • X (Twitter)

The preview should have

  • Article title,
  • Article content (clipped upto x words),
  • Article thumbnail if article image is present, else default app placeholder image

This is good ticket for someone who wants to dip their feet into SEO and social media marketing.
Refer this for implementation https://ogp.me/

Share screenshot of the end-result in the PR description.

Feature | Write article using Generative AI

When ?

User visits the app > Write >

What ?

If user has written the article title, An AI icon should appear.

(Something like this, but cooler and minimalistic animation)
Screenshot 2024-05-10 at 11 09 27 PM

If clicks on the AI icon, the app generates a draft article content based on the article title using GPT and inserts into the editor.
The user can choose to make adjustments in the draft from the editor and then publish the article.

The text generation should happen in the backend.
You can use GPT / Gemini to accomplish this.

Add a feature flag in the app so that this feature can be toggled on / off.
Ensure that the API_KEY resides within .env / toml file, not in your codebase.

Issue | Remove Dark mode TW classes

Dark mode is currently not configured and out of project scope at the moment.
However, there are places where dark: Tailwind class is used in certain places.

In Tailwind, the dark:[class] is applied automatically if user's default theme in OS is set to dark.

Therefore, Remove all tailwind classes with prefix dark: so that all type of users see uniform styling.

Screenshot:
Screenshot 2024-04-27 at 7 56 44 AM

Enhancement | Autosave while creating an article

Where ?

/write page

What ?

  • When user is writing an article, the app should autosave the changes every 15 seconds onto the local Storage.
  • When user redirects to other pages and revisits the write page, they should be able to see the saved content.
  • When user logs out and logs in again, visits the write page, they should still be able to see the save content. (until the scope of local storage)
  • If user A's article is autosaved, user A logouts. And user B logins on the same window and visits the write page, they should not be able to see the saved content of user A on the screen.

Feature | Display topics on the Blog page

If an article is linked to tags / topics, show all the topics at the end of the article.


Reference:

Screenshot 2024-05-22 at 5 19 47 PM


Pointers:

The api/v1/blog API returns the tags that's linked to the blog.

Screenshot 2024-05-22 at 5 23 10 PM

Bug | Layout shift when Bookmark button is clicked.

Current:

When an article is opened and the bookmark button is clicked,
The bookmark icon is replaced with a loader and then replaced by bookmarkIcon again.
The loader causes a layout shift which is a bad user experience.

Expectation:

The loader should not cause layout shift

Either eliminate the loader and use a different idea to show loading.
Or
Keep the loader but ensure the dimensions of the loader container and the bookmark container is exactly same so that layout shift is avoided.

Users should be able to delete their own articles

  • Add a delete route in the backend for blog entity
  • Add a delete flow in the frontend so that user who has created an article can delete.

Appropriate validations should be taken care of while doing this.

Enhancement | Enhance Password Input Visibility and Error Handling in Sign-In and Sign-Up Processes

Currently, the sign-in and sign-up processes in our application lack adequate feedback for password input, leading to usability and security concerns. Here are the main issues identified:

Password Visibility: The password input field does not provide visual feedback to users, making it difficult for them to verify their input. This poses a usability challenge, especially when typing complex passwords.

Mistake Recognition: Users are unable to identify if they've made a mistake while entering their password since the characters are not visible. This lack of feedback increases the likelihood of input errors and frustration.

Error Handling: In case of a password mistake, the system fails to provide any error message or indication, leaving users unaware of the issue.

Proposed Solution:
To address these issues, we propose the following enhancements:

Toggle Password Visibility: Implement a feature that allows users to toggle password visibility, displaying the characters as dots or revealing them when needed. This will enable users to verify their input and ensure accuracy.

Error Feedback: Provide real-time feedback to users if they make a mistake while entering their password. This could include visual cues such as color changes or error messages indicating an incorrect password.

Bug | Docker fails

Current:

When you run docker-compose up from root dir, docker fails to execute.

Expectation:

docker-compose up should spin up the frontend, the backend succesffully.

Fix | React-toast container width

If screen = mobile,
Notification width = screen width ✅ (this already works in most cases)

If screen > mobile [i.e. Tablet, desktop, ...],
Notification width = ~500px ❌

Reasoning:
The notification content should be displayed on 1 line ideally if character count is <= ~50 characters.
If notification character-count increases 50, wrap the content to next line.

The below notification content should have been displayed in 1 line.
Screenshot 2024-05-03 at 12 21 57 PM

Bug | Write page

Current:

Publish button is disabled even if Title & Description is entered

Screenshot 2024-05-20 at 10 10 40 PM

Expected:

Publish button should be enabled once user types Title & Description

Feature | Contributors page

Objective:

It's beautiful that the project is being developed by so many contributors. In order to acknowledge and appreciate your efforts, we'd like to build a Contributors page. This will be proof that you've contributed to the open source project. It may add value to portfolio / Resume for those who are seeking work/employment.

What ?

  • This Github API returns the list of contributors - GET https://api.github.com/repos/aadeshkulkarni/medium-app/contributors

  • Create a /contributors page that will provide:

    • A list of Contributors (Each item in the list can be a card with profile image, name, a redirect to their Github profile)

    Page should be mobile & desktop responsive.

Feature | User should be able to search articles

When user is on the /blogs route, they should be able to search articles using keyword.

Requirement

  • Build a backend route GET for search or re-use the existing /blog/bulk GET route
  • Search component in the frontend with search box & search results.

PS: Searching should be debounced. (Either using lodash or create your own debounced implementation for this)

The search API should be scalable. In future, user should be able to search another user as well.

issue with backend url ??

when i replace backend url with my own backend url of cloudflare wokers it give a lot of error while i use your url it works very well ... how is it possible
Screenshot 2024-05-20 204012

Feature | Add tags while publishing an article

Frontend:

  • User is writing a new article.
  • When user clicks on publish button, a modal popup should appear.
  • The user can add upto 5 topics related to the article they are publishing.
  • The topics should be entered in a textfield comma-separated by topic.

Backend:

  • If Tag already exists in tag table, link the tag to the post.
  • If Tag does not exist, create the tag and then link to the post.

The DB Schema for Tag is already created. Only the POST /blog endpoint needs to be updated.

Reference:
Screenshot 2024-05-08 at 4 50 22 AM

Enhancement | Redesign the Landing page

This is an open-to-imagination ticket.
You can use your creativity to craft an intuitive, minimalistic landing page that looks beautiful.

Constraints:

  • Minimise use of third party libraries (You can use animation libraries like framer motion, gsap, threejs, lottie files, or anything else. But ensure that the page is lightweight and performant)
  • The theme is minimalism, professional and easy on the eye. Consider colour-contrast-ratio and typography as well.
  • Page should be responsive for mobile & desktop viewports

You can draw inspirations from existing blogging applications, dribbble.com and so on.

Current Landing page: https://medium-app-zeta.vercel.app/

Screenshot 2024-05-08 at 8 36 55 PM

Enhancement | Write page

Current:

Screenshot 2024-05-14 at 9 42 20 PM

Expectation:

Similiar to https://medium.com/p/3434770f0676/edit

  • Title should have a placeholder 'Tell your story', formatting should be like shown below (Ignore the + icon for now)
  • The text editor should not have a border, should be centred.
  • Publish button should be at the top instead of bottom.
  • Menu and Notification icons are both out of scope of this ticket.
  • Autosave / Draft feature is out of scope (but needs to be implemented in future)
Screenshot 2024-05-14 at 9 39 31 PM

Bug | Deleting your own article

When ?

  • User signs in
  • User clicks on an article that's created by themself.
  • User clicks on delete button icon.

What ?

  • The backend API returns 411 with the error 'Something went wrong'

Screenshot:

Screenshot 2024-05-23 at 10 33 30 AM

Bonus points:

  • Ideally, when user clicks on the delete icon, user should be shown confirm dialog before actually deleting the article. A-1 if you can implement it in this ticket. (Optional)

Bug | Login & Signup UI for Mobile

The signup and signin pages are janky for smaller mobile screens like iphone 12, 13

Current UI

Screenshot 2024-05-08 at 8 40 43 PM

Expected UI

There should be sufficient padding on x axis (left and right) of the form fields on mobile viewport.

Feature | DB Seeding

What is DB Seeding?

Seeding allows you to consistently re-create the same data in your database and can be used to:

  • Populate your database with data that is required for your application to start - for example, a default language or a default currency.
  • Provide basic data for validating and using your application in a development environment. This is particularly useful if you are using Prisma Migrate, which sometimes requires resetting your development database.

Requirement

  • Setup a DB Seeding script within the backend
  • Seed Tags data in the tag table.
  • From where to get the tags data ? Refer Medium's page - https://medium.com/explore-topics

Pointers

  • The backend already has a Tag table.
  • The official Medium app has 3 levels of Tags: For example, Life > Family > Adoption. Although it would be wonderful to have something like that in our application, this will add unnecessary complications at the moment. We want to create only 1 level of Tag.

Bug | When user clicks on publish button, no indications that the article is being published

Current:

When a user is writing a new article, on publish button click, the app takes time to publish the article and redirect to the published article. There is no indication (in the form of loader or something else) that the informs the user app is publishing.

Expectation:

When user clicks the publish button, disable the button & show a loader within the button until the event handler finishes execution. (Consider happy & sad flows)

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.