Table of Contents
Anon is a platform that provides features similar to those of social media platforms. It allows its users to like, save, and share posts, just like they can on other social media platforms.
- Lucide for icons
- Tiptap & Novel for Notion-style WYSIWYG text editor and content display
- Shadcn as a component library and theme creator
- Shadcn uses React-hook-form and Radix-UI under the hood
- Tanstack for React-Query (infinite query)
- Complete user account and user authentication process - Supabase
- Google OAuth - Supabase
- Custom content validation and data integrity - Prisma, Zod
- Mutli-layer caching for improved performance - Nextjs, Tanstack Query
- Notion-style Rich text editor - novel.sh & Tiptap
- Custom Infinite scroll - Tanstack Query, React Hooks
- Light/Dark theme - next-themes
- SSR for improved performance - Nextjs
- Custom hooks (localstorage, throttle) - React
- Types of endpoints:
- flag for post if the user has liked this post
- flag for post if the user has saved this post
- authorId is set to 'author' if the user is the author
- /api/auth/callback
Callback endpoint to authenticate user from an external provider (Google OAuth)
Redirects the user to /
- /api/post?page={page}
params: { page: number }
Returns the page of posts, each page is limited to 50 posts
Page is defaulted to 0 if param doesn't exist
Return data:
{
id: string,
createdAt: Date,
content: JsonValue(object),
likes: number,
reports: number,
authorId: string,
liked?: string | null,
saved?: string | null
}[]
Below endpoints are only accessible to authenticated users
Request will error if authenticated user does not exist
/api/post
/api/post/like
/api/post/report
/api/user
- /api/user?page={page}
params: { page: number }
Returns the page of posts that the user has created, each page is limited to 50 posts
Page is defaulted to 0 if param doesn't exist
Return data:
{
id: string,
createdAt: Date,
content: JsonValue(object),
likes: number,
reports: number,
authorId: 'author',
liked?: string | null,
saved?: string | null
}[]
# authorId is defaulted here to 'author' because all posts are expected to be the user's
/api/user/saved
- /api/user/saved?page={page}
params: { page: number }
Returns the page of posts that the user has saved, each page is limited to 50 posts
Page is defaulted to 0 if param doesn't exist
Return data:
{
id: string,
createdAt: Date,
content: JsonValue(object),
likes: number,
reports: number,
authorId: string,
liked?: string | null,
saved?: string | null
}[]