A full-featured social feed application built with Next.js, Supabase, and React Query. Meadows lets users create posts (with optional images), follow other users, like posts, and manage their profiles. It includes infinite scrolling, light/dark mode, and a responsive, mobile-friendly design.
Important
Live Web App: https://meadows.vercel.app/ π
Please give it a try and start sharing your thoughts stylishly!
- Features
- Tech Stack
- Getting Started
- Environment Variables
- Project Structure
- Key Components
- Scripts
- Supabase Setup
- Testing & Formatting
- GitHub Actions
- Contributing
- License
- Acknowledgments
- Contact
- User Authentication via Supabase
- Profile Management: upload/change avatar, view followers/following
- Post Creation: text + image uploads
- Infinite Scrolling for feeds and profiles
- Like/Unlike posts
- Follow/Unfollow other users
- Light/Dark Mode toggle
- Share & Copy Link buttons using Web Share API
- Responsive Layout spanning full width
- Client-side Bookmarking (via
localStorage
) - Server-Side Rendering for initial data fetch
- TypeScript for type safety
- Zod for schema validation
- ESLint & Prettier for code quality
- and more!
- Framework: Next.js
- Authentication & Database: Supabase
- Data Fetching: React Query
- UI Components: Custom, plus lucide-react icons
- Styling: Tailwind CSS (via shadcn/ui conventions)
- File Storage: Supabase Storage
- and more!
- Clone the repo
git clone https://github.com/hoangsonww/Meadows-Social-Media.git
cd Meadows-Social-Media/web
- Install dependencies
npm install
# or
yarn
-
Set up environment variables (see next section)
-
Run the dev server
npm run dev
# or
yarn dev
Open http://localhost:3000 in your browser.
Create a .env.local
file at project root with:
NEXT_PUBLIC_SUPABASE_URL=<your_supabase_url>
NEXT_PUBLIC_SUPABASE_ANON_KEY=<your_supabase_anon_key>
You can find these in your Supabase project settings.
/
βββ components/ # Reusable React components
β βββ feed.tsx
β βββ post.tsx
β βββ ui/ # shadcn/ui-style components
β βββ ...
βββ pages/ # Next.js pages
β βββ index.tsx # Home feed
β βββ post/[id].tsx # Single post view
β βββ profile/[id].tsx # Public profile page
β βββ _app.tsx
βββ utils/
β βββ supabase/
β β βββ clients/ # Supabase client creators
β β βββ queries/ # DB query functions
β βββ models/ # zod schemas
βββ public/ # Static assets
βββ styles/ # Global CSS (if any)
βββ README.md
βββ package.json
- Logo + subtitle
- Light/Dark mode toggle
- User dropdown: view profile, sign out
- βWrite a Postβ card with image upload
- Tabs: Feed / Following / Liked
- Inline infinite scroll of
<PostCard />
- Renders
<PostCard />
components inline - IntersectionObserver to fetch more
- Single post view
- Share, copy link, email, print, bookmark button
- Profile header: avatar, name, handle, follow button
- Stats: posts, followers, following
- Infinite scroll of userβs posts
- Modals for followers/following lists
dev
: Start development serverbuild
: Create a production buildstart
: Run production buildlint
: Run ESLintformat
: Run Prettier
This project uses Supabase for authentication and database management. Supabase provides a powerful backend-as-a-service solution that integrates seamlessly with Next.js applications.
To set up Supabase:
- Create a new project on Supabase.
- Set up authentication providers (email/password).
- Create a
posts
table with the following schema:id
: UUID (Primary Key)user_id
: UUID (Foreign Key to users)content
: Textimage_url
: Text (optional)created_at
: Timestamp
- Create a
users
table with the following schema:id
: UUID (Primary Key)username
: Text (Unique)email
: Text (Unique)avatar_url
: Text (optional)created_at
: Timestamp
- Do the same for the other tables like
followers
,likes
, etc., as per the schema definitions in the database directory. - Set up Row Level Security (RLS) policies for the
posts
andusers
tables to allow authenticated users to read/write their own data. - Enable Supabase Storage for image uploads.
- Enable Supabase Auth for user management.
- Update the
.env.local
file with your Supabase URL and anon key. - Manage your database and tables using the Supabase dashboard as you develop your application.
FYI, you can find the schema definitions under the database directory. Below is a visual representation of the database schema:
This project uses Jest for testing and Prettier for code formatting.
To run tests:
cd web
npm run test
# or
yarn test
# To run tests in watch mode
npm run test:watch
# or
yarn test:watch
# To run tests with coverage report
npm run test:coverage
# or
yarn test:coverage
To format code:
cd web
npm run format
# or
yarn format
Running npm run format
will automatically format your code according to the Prettier configuration. It is recommended to run this command every time before committing changes to ensure consistent code style.
This project uses GitHub Actions for continuous integration. The workflow is defined in .github/workflows/ci.yml
. It runs the following checks on every push and pull request:
- Linting with ESLint
- Formatting with Prettier
- Running tests with Jest
- Building the Next.js application
- Checking for type errors with TypeScript
- Deploying to Vercel if all checks pass
The workflow ensures that all code changes meet the project's quality standards before being merged into the main branch.
- Fork this repo
- Create a feature branch (
git checkout -b feature/x
) - Commit your changes (
git commit -m "feat: your message"
) - Push to your branch (
git push origin feature/x
) - Open a pull request
Please ensure all new code is covered by tests and adheres to the projectβs coding standards.
This project is licensed under the MIT License. See the LICENSE file for details.
Please note that while this project is open-source, it is intended for educational purposes and personal use. Please do not use it for commercial purposes without prior permission, and always give credit to the original authors regardless of usage.
Big thanks to Prof. Ajay Gandecha at UNC-Chapel Hill for the inspiration and basic structure of this project. The original project was a simple social media app, and this version has been significantly expanded with additional features and improvements.
Additionally, thanks to the open-source community for the libraries and tools that made this project possible, including Next.js, Supabase, React Query, Tailwind CSS, and many others.
If you have any questions or feedback, feel free to reach out to me via either:
- Email: hoangson091104@gmail.com
- GitHub: hoangsonww
- LinkedIn: Son Nguyen
I welcome contributions, suggestions, and any issues you may encounter while using this project. Your feedback is invaluable in making Meadows better for everyone!
Thank you for checking out Meadows! I hope you find it useful and enjoyable to use. If you have any questions or suggestions, feel free to reach out or open an issue on GitHub. Happy coding! π