Flybook
Flybook, a pixel perfect Facebook clone, is a popular social media website that allows users to publicly share profile, share posts, leave comments, and add other users as friends.
Install / Use
/learn @rsdimatulac/FlybookREADME
Welcome to Flybook!
Live Link: Flybook
Flybook, a pixel perfect Facebook clone, is a popular social media website that allows users to publicly share profile, share posts, leave comments, and add other users as friends.
News Feed View

Profile View

Prerequisites
Before you begin, please check the following Wiki documents:
Technologies used:
Backend
- Python
- Flask
- SQLAlchemy
- PostgreSQL
- Docker
wtforms,wtforms validators
Frontend
- React.js
- Redux
- JavaScript
- HTML, Vanilla CSS
- Heroku (for hosting services)
- AWS (photo bucket)
- Material UI Icons
react-icons,date-fns
Code Highlights / Challenges
Highlights
- These code shows how to correctly determine the join condition between parent/child tables when having multiple foreign keys that are referencing the same table. In this case, the Post model below have two foreign keys
user_idandwall_idthat are pointing to theusers.idin the User model. By explicitly addingforeign_keysargument on both relationships will help SQLAlchemy know how to handle these conditions and not throw anAmbiguousForeignKeysError.
app/models/user.py
post_sender = db.relationship(
'Post',
back_populates='post_user_id',
foreign_keys=Post.user_id,
cascade='all, delete-orphan'
)
post_receiver = db.relationship(
'Post',
back_populates='post_wall_id',
foreign_keys=Post.wall_id,
cascade='all, delete-orphan'
)
app/models/post.py
user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
wall_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
post_user_id = db.relationship(
'User',
back_populates='post_sender',
foreign_keys=user_id
)
post_wall_id = db.relationship(
'User',
back_populates='post_receiver',
foreign_keys=wall_id
)
- When a user activates the search bar, the search dropdown will show. Based on the search input values, the
handleSearch()function is invoked when anonChange()event occurs. It uses.filter()to iterate through the channels and dynamically displays and returns what matches the search input value. When a user clicks on the search result, they will be redirected to the user profile.
react-app/src/components/NavBar.js
const handleSearch = (e) => {
if (e.target.value === "") {
setSearchInput("");
setSearchResults([]);
};
if (e.target.value.length > 0) {
let filteredResults = Object.values(users).filter(user =>
user['firstname']?.toLowerCase().includes(e.target.value.toLowerCase())
|| user['lastname']?.toLowerCase().includes(e.target.value.toLowerCase())
);
setSearchInput(e.target.value);
setSearchResults(filteredResults);
};
};
Challenges
- My biggest challenge was getting an
AmbiguousForeignKeysErrorby not setting the proper foreign key relationship between User and Post models. In the Post model, I have two foreign keysuser_idandwall_idthat are both referencing theusers.idin the User model. After parsing through SQLAlchemy documentation, I was able to setup the proper relationship by explicitly addingforeign_keysargument on both models and correctly determined the join condition between parent/child tables. See code snippet above.
Future Implementations
- Friend Requests
- Notifications
- Dark mode
- Responsive design
Flybook Developer
© 2021 Flybook. No rights reserved.
Related Skills
bluebubbles
343.3kUse when you need to send or manage iMessages via BlueBubbles (recommended iMessage integration). Calls go through the generic message tool with channel="bluebubbles".
bear-notes
343.3kCreate, search, and manage Bear notes via grizzly CLI.
claude-seo
3.7kUniversal SEO skill for Claude Code. 19 sub-skills, 12 subagents, 3 extensions (DataForSEO, Firecrawl, Banana). Technical SEO, E-E-A-T, schema, GEO/AEO, backlinks, local SEO, maps intelligence, Google APIs, and PDF/Excel reporting.
claude-ads
1.5kComprehensive paid advertising audit & optimization skill for Claude Code. 186 checks across Google, Meta, YouTube, LinkedIn, TikTok & Microsoft Ads with weighted scoring, parallel agents, and industry templates.
