Explore the live demonstration of the project: nextjs14-snapshot
SnapShot is a modern social app with a stunning UI with a native mobile feel, a special tech stack, an infinite scroll feature, and amazing performance using Next.js, Appwrite, TypeScript, and more.
Folder Structure
nextjs14-snapshot/
βββ app/
β βββ (auth)/
β β βββ sign-in/[[...sign-in]]/
β β β βββ page.tsx
β β βββ sign-up/[[...sign-up]]/
β β β βββ page.tsx
β β βββ layout.tsx
β βββ (root)/
β β βββ layout.tsx
β β βββ (home)/
β β β βββ page.tsx
β β βββ collection/
β β β βββ page.tsx
β β βββ community/
β β β βββ page.tsx
β β βββ explore/
β β β βββ page.tsx
β β βββ create-post/
β β β βββ page.tsx
β β βββ edit-post/
β β β βββ [id]/
β β β βββ page.tsx
β β βββ edit-profile/
β β β βββ [id]/
β β β βββ page.tsx
β β βββ posts/
β β β βββ [id]/
β β β βββ page.tsx
β β βββ profile/
β β βββ [id]/
β β βββ followers/
β β β βββ page.tsx
β β βββ following/
β β β βββ page.tsx
β β βββ page.tsx
β βββ favicon.ico
β βββ globals.css
β βββ layout.tsx
βββ components/
β βββ cards/
β β βββ FollowCard.tsx
β β βββ PostCard.tsx
β β βββ UserCard.tsx
β βββ forms/
β β βββ Auth.tsx
β β βββ Post.tsx
β β βββ Profile.tsx
β βββ scenes/
β β βββ AllStories.tsx
β β βββ AllUsers.tsx
β β βββ Follows.tsx
β β βββ Post.tsx
β β βββ Profile.tsx
β β βββ RecentPosts.tsx
β β βββ SavedPosts.tsx
β βββ shared/
β β βββ FileUploader.tsx
β β βββ GridPostList.tsx
β β βββ PostStats.tsx
β β βββ Story.tsx
β β βββ atoms/
β β β βββ Alert.tsx
β β β βββ Loader.tsx
β β βββ layout/
β β β βββ Bottombar.tsx
β β β βββ LeftSidebar.tsx
β β β βββ RightSidebar.tsx
β β β βββ Topbar.tsx
β β βββ search/
β β βββ LocalResult.tsx
β β βββ LocalSearchbar.tsx
β βββ ui/ (generated by shadcn-ui)
β βββ button.tsx
β βββ dialog.tsx
β βββ form.tsx
β βββ input.tsx
β βββ label.tsx
β βββ tabs.tsx
β βββ textarea.tsx
β βββ toast.tsx
β βββ toaster.tsx
β βββ use-toast.ts
βββ appwrite/
β βββ env.ts
β βββ client.ts
β βββ actions/
β β βββ post.action.ts
β β βββ save.action.ts
β β βββ user.action.ts
β βββ conf/
β βββ index.ts
βββ constants/
β βββ index.ts
βββ context/
β βββ AuthContext.tsx
βββ hooks/
β βββ useDebounce.ts
βββ lib/
β βββ utils.ts
β βββ react-query/
β β βββ Provider.tsx
β β βββ QueryKeys.ts
β β βββ mutations/
β β β βββ post.mutation.ts
β β β βββ save.mutation.ts
β β β βββ user.mutation.ts
β β βββ queries/
β β βββ post.mutation.ts
β β βββ user.mutation.ts
β βββ validations/
β βββ index.ts
βββ public/
β βββ next.svg
β βββ vercel.svg
β βββ assets/
β βββ icons/[[...]].svg
β βββ images/[[...]].{svg,png}
βββ styles/
β βββ prism.css
β βββ theme.css
βββ types/
β βββ index.d.ts
βββ .eslintrc.json
βββ .prettierrc
βββ .gitignore
βββ README.md
βββ components.json
βββ next.config.js
βββ package.json
βββ postcss.config.js
βββ tailwind.config.ts
βββ tsconfig.ts
Table of Contents
SnapShot is built using the following technologies:
- TypeScript: TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
- Next.js: Next.js is a React framework for building server-side rendered and statically generated web applications.
- Tailwind CSS: Tailwind CSS is a utility-first CSS framework for rapidly building custom user interfaces.
- ESLint: ESLint is a static code analysis tool for identifying problematic patterns found in JavaScript code.
- Prettier: Prettier is an opinionated code formatter.
- Shadcn-UI: Shadcn UI is a React UI library that helps developers rapidly build modern web applications.
- Appwrite: Appwrite is a secure end-to-end backend server for Web, Mobile, and Flutter developers that is packaged as a set of Docker containers for easy deployment.
- React Query: React Query is a data-fetching library for React.
- Query String: Parse and stringify URL query strings.
- Zod: Zod is a TypeScript-first schema declaration and validation library.
- Vercel: Vercel is a cloud platform for frontend developers, providing the frameworks, workflows, and infrastructure to build a faster, more personalized Web.
To get this project up and running in your development environment, follow these step-by-step instructions.
In order to install and run this project locally, you would need to have the following installed on your local machine.
Step 0:
Note NEXT_PUBLIC_APPWRITE_PROJECT_ID
and NEXT_PUBLIC_APPWRITE_URL
environment variables in .env
file.
Also,
- you need to create a new storage in Appwrite called
media
and set theNEXT_PUBLIC_APPWRITE_STORAGE_ID
environment variable in.env
file. - you need to create a new database in Appwrite and set the
NEXT_PUBLIC_APPWRITE_DATABASE_ID
environment variable in.env
file. - within the database, you need to create those collections:
posts
,users
, andsaves
and set theNEXT_PUBLIC_APPWRITE_{NAME}_COLLECTION_ID
environment variable in.env
file.
(the storage and database design can be found in Reference)
Step 1:
Download or clone this repo by using the link below:
git clone https://github.com/ladunjexa/nextjs14-snapshot.git
Step 2:
Execute the following command in the root directory of the downloaded repo in order to install dependencies:
npm install
Step 3:
Execute the following command in order to run the development server locally:
npm run dev
Step 4:
Open http://localhost:3000 with your browser to see the result.
All scripts are defined in the package.json
file. Here is a list of all scripts:
Script | Action |
---|---|
npm install |
Installs dependencies |
npm run dev |
Starts local dev server at localhost:3000 |
npm run build |
Build your production site to ./dist/ |
npm run start |
Start your production site locally |
npm run lint |
Run ESLint |
Environment variables[^7] can be used for configuration. They must be set before running the app.
Environment variables are variables that are set in the operating system or shell, typically used to configure programs.
SnapShot uses Appwrite as external service. You need to create an account on Appwrite and get the required credentials to run the app.
Create a .env
file in the root directory of the project and add the following environment variables:
NEXT_PUBLIC_APPWRITE_PROJECT_ID=<NEXT_PUBLIC_APPWRITE_PROJECT_ID>
NEXT_PUBLIC_APPWRITE_URL=<NEXT_PUBLIC_APPWRITE_URL>
NEXT_PUBLIC_APPWRITE_STORAGE_ID=<NEXT_PUBLIC_APPWRITE_STORAGE_ID>
NEXT_PUBLIC_APPWRITE_DATABASE_ID=<NEXT_PUBLIC_APPWRITE_DATABASE_ID>
NEXT_PUBLIC_APPWRITE_USER_COLLECTION_ID=<NEXT_PUBLIC_APPWRITE_USER_COLLECTION_ID>
NEXT_PUBLIC_APPWRITE_POST_COLLECTION_ID=<NEXT_PUBLIC_APPWRITE_POST_COLLECTION_ID>
NEXT_PUBLIC_APPWRITE_SAVES_COLLECTION_ID=<NEXT_PUBLIC_APPWRITE_SAVES_COLLECTION_ID>
You can create an optimized production build with the following command:
npm run build
The easiest way to deploy this Next.js app is to use the Vercel Platform.
You can also deploy this Next.js app with Netlify.
Check out Next.js deployment documentation for more details.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
To fix a bug or enhance an existing module, follow these steps:
- Fork the repo
- Create a new branch (
git checkout -b improve-feature
) - Make the appropriate changes in the files
- Commit your changes (
git commit -am 'Improve feature'
) - Push to the branch (
git push origin improve-feature
) - Create a Pull Request π
If you find a bug (failure of a module to execute its intended function), kindly open an issue here by including the issue with a title and clear description.
If you'd like to request a new function, feel free to do so by opening an issue here. Please include sample queries and their corresponding results.
I'd like to express my gratitude to the following people who helped me with this project and made it possible:
JSMastery. (2023). Build and Deploy a Full Stack Social Media App | React JS, Appwrite, Tailwind CSS, React Query. YouTube.
SnapShot is open source software licensed as MIT and is free to use β See LICENSE for more details.