A modern, full-featured social media application built with React, TypeScript, and Appwrite. Snapgram allows users to share posts, interact with content, explore feeds, and connect with other users in a responsive and intuitive interface.
-
User Authentication
- Sign up and sign in functionality
- Secure authentication with Appwrite
- Protected routes for authenticated users
- Persistent user sessions
-
Post Management
- Create posts with images and captions
- Edit and update existing posts
- Delete posts
- Add location and tags to posts
- File upload with drag-and-drop support
-
Social Interactions
- Like and save posts
- View liked posts collection
- View saved posts collection
- Explore feed with infinite scroll
- Post details view with comments
-
User Features
- User profiles with bio and avatar
- Update profile information
- Upload custom profile pictures
- View all users in the platform
- User cards with follow functionality
-
Modern UI/UX
- Responsive design for mobile, tablet, and desktop
- Dark theme interface
- Smooth animations and transitions
- Toast notifications for user feedback
- Loading states and skeletons
- Bottom navigation bar for mobile
- Sidebar navigation for desktop
- React 18.2 - UI library
- TypeScript - Type safety and better developer experience
- Vite - Fast build tool and development server
- React Router DOM - Client-side routing
- Tailwind CSS - Utility-first CSS framework
- shadcn/ui - Re-usable UI components built with Radix UI
- Appwrite - Backend as a Service (BaaS)
- Authentication
- Database
- File Storage
- Real-time capabilities
- TanStack Query (React Query) - Server state management and caching
- React Context API - Global authentication state
- React Hook Form - Performant form management
- Zod - TypeScript-first schema validation
- Radix UI - Accessible component primitives
- Lucide React - Icon library
- React Dropzone - File upload component
- React Intersection Observer - Infinite scroll implementation
src/
βββ _auth/ # Authentication layouts and forms
β βββ AuthLayout.tsx # Layout wrapper for auth pages
β βββ forms/
β βββ SigninForm.tsx # Sign in form component
β βββ SignupForm.tsx # Sign up form component
β
βββ _root/ # Main application layouts and pages
β βββ RootLayout.tsx # Layout wrapper for authenticated pages
β βββ pages/ # Application pages
β βββ Home.tsx # Home feed
β βββ Explore.tsx # Explore posts
β βββ Saved.tsx # Saved posts
β βββ CreatePost.tsx # Create new post
β βββ EditPost.tsx # Edit existing post
β βββ PostDetails.tsx # Post detail view
β βββ AllUsers.tsx # All users list
β βββ Profile.tsx # User profile
β βββ UpdateProfile.tsx # Update profile
β βββ LikedPosts.tsx # Liked posts collection
β
βββ components/
β βββ forms/
β β βββ PostForm.tsx # Reusable post form component
β βββ shared/ # Shared/reusable components
β β βββ Topbar.tsx # Top navigation bar
β β βββ LeftSidebar.tsx # Desktop sidebar
β β βββ Bottombar.tsx # Mobile bottom navigation
β β βββ PostCard.tsx # Post card component
β β βββ PostStats.tsx # Post statistics (likes, saves)
β β βββ UserCard.tsx # User card component
β β βββ GridPostList.tsx # Grid layout for posts
β β βββ FileUploader.tsx # File upload component
β β βββ ProfileUploader.tsx # Profile image uploader
β β βββ Loader.tsx # Loading spinner
β βββ ui/ # shadcn/ui components
β βββ button.tsx
β βββ form.tsx
β βββ input.tsx
β βββ label.tsx
β βββ textarea.tsx
β βββ toast.tsx
β βββ toaster.tsx
β
βββ context/
β βββ AuthContext.tsx # Authentication context provider
β
βββ lib/
β βββ appwrite/
β β βββ api.ts # Appwrite API functions
β β βββ config.ts # Appwrite configuration
β βββ react-query/
β β βββ queries.ts # React Query hooks
β β βββ queryKeys.ts # Query key constants
β β βββ QueryProvider.tsx # Query client provider
β βββ validation/
β β βββ index.ts # Zod validation schemas
β βββ utils.ts # Utility functions
β
βββ types/
β βββ index.ts # TypeScript type definitions
β
βββ hooks/
β βββ useDebounce.ts # Custom debounce hook
β
βββ constants/
β βββ index.ts # Application constants
β
βββ App.tsx # Main application component
βββ main.tsx # Application entry point
βββ globals.css # Global styles
- Node.js (v16 or higher)
- npm or yarn package manager
- Appwrite account and project
-
Clone the repository
git clone <repository-url> cd react-social-media-app
-
Install dependencies
npm install
-
Set up Appwrite
- Create an account at Appwrite
- Create a new project
- Set up the following:
- Authentication (Email/Password provider)
- Database with collections for:
- Users
- Posts
- Saves
- Storage bucket for media files
-
Configure environment variables
Create a
.env.localfile in the root directory:VITE_APPWRITE_URL=your_appwrite_endpoint VITE_APPWRITE_PROJECT_ID=your_project_id VITE_APPWRITE_DATABASE_ID=your_database_id VITE_APPWRITE_STORAGE_ID=your_storage_bucket_id VITE_APPWRITE_USER_COLLECTION_ID=your_user_collection_id VITE_APPWRITE_POST_COLLECTION_ID=your_post_collection_id VITE_APPWRITE_SAVES_COLLECTION_ID=your_saves_collection_id
-
Run the development server
npm run dev
-
Open your browser
Navigate to
http://localhost:5173
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
- accountId (string)
- name (string)
- username (string)
- email (string)
- imageUrl (string)
- bio (string)
- creator (relationship to Users)
- caption (string)
- imageUrl (string)
- imageId (string)
- location (string)
- tags (array of strings)
- likes (array of user IDs)
- user (relationship to Users)
- post (relationship to Posts)
The project uses Tailwind CSS with a custom configuration for:
- Dark theme color palette
- Custom utility classes
- Responsive breakpoints
- Animations from tailwindcss-animate
- User signs up with name, username, email, and password
- Appwrite creates an account and generates avatar initials
- User data is saved to the database
- User can sign in with email and password
- Authentication state is managed globally via Context API
- Protected routes check authentication status
- Users are redirected to sign-in if not authenticated
Uses React Intersection Observer to detect when the user scrolls to the bottom and fetches more posts automatically.
Drag-and-drop file upload with preview functionality using react-dropzone.
React Query handles optimistic updates for likes and saves, providing instant feedback to users.
Zod schemas validate all forms before submission, ensuring data integrity.
Mobile-first approach with breakpoints for tablet and desktop views.
The project includes a custom SVG favicon located at public/favicon.svg. To generate PNG versions for better browser compatibility:
# Run the favicon generation script
chmod +x scripts/generate-favicons.sh
./scripts/generate-favicons.shOr use an online tool like RealFaviconGenerator
The application is optimized for search engines with:
- Meta Tags: Comprehensive meta tags for search engines
- Open Graph: Social media sharing optimization (Facebook, LinkedIn)
- Twitter Cards: Twitter-specific meta tags
- Structured Data: JSON-LD schema for better search results
- Sitemap: XML sitemap at
/sitemap.xml - Robots.txt: Search engine crawling instructions
- Semantic HTML: Proper heading hierarchy and ARIA labels
- Mobile-Friendly: Responsive design with viewport meta tag
- Performance: Optimized images and lazy loading
Progressive Web App manifest included at public/site.webmanifest:
- Installable on mobile devices
- Custom theme colors
- App icons for various platforms
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
Note: Make sure to configure your Appwrite backend properly and set up all required collections and storage buckets before running the application.




