{"id":18938124,"url":"https://github.com/psidh/redx","last_synced_at":"2026-04-15T05:31:54.799Z","repository":{"id":221384847,"uuid":"751208547","full_name":"psidh/RedX","owner":"psidh","description":"RedX is a Social Media application that integrates with Google authentication to provide a streamlined user sign-up and login process. After signing in with Google, users can set up their username and access the app's features. Post thoughts, like a post, comment on a post, and search for users or posts using the search bar","archived":false,"fork":false,"pushed_at":"2024-12-07T07:36:11.000Z","size":914,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-01T16:15:10.411Z","etag":null,"topics":["full-stack","next-auth","nextjs","postgresql","prisma","react","tailwindcss","typescript"],"latest_commit_sha":null,"homepage":"https://redx-psidh.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/psidh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-01T06:26:22.000Z","updated_at":"2024-12-07T07:36:09.000Z","dependencies_parsed_at":"2024-12-07T08:31:11.856Z","dependency_job_id":null,"html_url":"https://github.com/psidh/RedX","commit_stats":null,"previous_names":["psidh/twitter","psidh/redx"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/psidh/RedX","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psidh%2FRedX","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psidh%2FRedX/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psidh%2FRedX/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psidh%2FRedX/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/psidh","download_url":"https://codeload.github.com/psidh/RedX/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psidh%2FRedX/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31828530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T18:05:02.291Z","status":"online","status_checked_at":"2026-04-15T02:00:06.175Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["full-stack","next-auth","nextjs","postgresql","prisma","react","tailwindcss","typescript"],"created_at":"2024-11-08T12:13:28.462Z","updated_at":"2026-04-15T05:31:54.777Z","avatar_url":"https://github.com/psidh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RedX\n\nRedX is a Social Media application that integrates with Google authentication to provide a streamlined user sign-up and login process. After signing in with Google, users can set up their username and access the app's features.\nPost thoughts, like a post, comment on a post, and search for users or posts using the search bar. The app's layout is responsive, adapting to different screen sizes, and includes a fixed sidebar and bottom bar for easy navigation.\n\n## Getting Started\n\nFirst, clone the repository and install the dependencies:\n\n```bash\ngit clone https://github.com/your-username/redx.git\ncd redx\nnpm install\n# or\nyarn install\n# or\npnpm install\n# or\nbun install\n```\n\nThen, run the development server:\n\n```bash\nnpm run dev\n# or\nyarn dev\n# or\npnpm dev\n# or\nbun dev\n```\n\nOpen [http://localhost:3000](http://localhost:3000) with your browser to see the result.\n\nYou can start editing the page by modifying `app/home/page.tsx`. The page auto-updates as you edit the file.\n\n## Features\n\n- **Google Authentication**: Users sign in using their Google account.\n- **Username Setup**: After signing in, users are prompted to choose a unique username.\n- **Responsive Layout**: The app's layout adapts to different screen sizes, similar to Twitter's responsive design.\n- **Sidebar and Bottom Bar**: Fixed sidebar and bottom bar for easy navigation, ensuring they are not scrollable while the main content scrolls.\n\n## Environment Variables\n\nTo run this project, you will need to set up the following environment variables. Create a `.env.local` file in the root of your project and add the following:\n\n```plaintext\nGOOGLE_CLIENT_ID=your-google-client-id\nGOOGLE_CLIENT_SECRET=your-google-client-secret\nNEXTAUTH_SECRET=your-next-auth-secret\nDATABASE_URL=your-database-url\n```\n\n## Folder Structure\n\n- `components/Home/Sidebar.tsx`: Sidebar component with navigation links.\n- `components/Home/BottomBar.tsx`: Bottom bar component with navigation links.\n- `components/Home/SearchBar.tsx`: Search bar component with integrated search functionality.\n\n## Middleware\n\nThe middleware handles user authentication and redirects appropriately. Here is the middleware setup:\n\n```typescript\nimport { NextResponse } from \"next/server\";\nimport type { NextRequest } from \"next/server\";\n\nexport function middleware(request: NextRequest) {\n  const path = request.nextUrl.pathname;\n  const publicPaths = [\"/auth\", \"/api/auth/signin\", \"/auth/signin\"];\n  const isPublicPath = publicPaths.includes(path);\n  const token = request.cookies.get(\"next-auth.session-token\")?.value;\n\n  if (isPublicPath \u0026\u0026 token) {\n    return NextResponse.redirect(new URL(\"/auth/signin\", request.nextUrl));\n  }\n\n  if (!isPublicPath \u0026\u0026 !token) {\n    return NextResponse.redirect(new URL(\"/auth\", request.nextUrl));\n  }\n}\n\nexport const config = {\n  matcher: [\"/home\", \"/api/auth/signin\", \"/auth\", \"/profile\", \"/\"],\n};\n```\n\n## API Endpoints\n\n- **`/api/user`**: Checks if the user exists in the database.\n- **`/api/signup`**: Handles user signup by creating a new user in the database.\n\n### Example Usage in API Routes\n\n```typescript\nimport { NextResponse, NextRequest } from \"next/server\";\nimport { prisma } from \"@/lib/prisma\";\n\nexport async function POST(req: NextRequest) {\n  try {\n    const { username } = await req.json();\n    \n    if (!username) {\n      return NextResponse.json({ error: \"Username not given\", status: 411 });\n    }\n\n    const user = await prisma.user.findUnique({\n      where: {\n        username: username,\n      },\n    });\n\n    if (!user) {\n      return NextResponse.json({ error: \"User not found\", status: 404 });\n    }\n    return NextResponse.json({ user, status: 200 });\n  } catch (error: any) {\n    return NextResponse.json({\n      error: \"Error on the server api/user\",\n      status: 500,\n    });\n  }\n}\n```\n\n## Database Connection Management\n\nTo avoid the \"Too many database connections\" error, ensure you are using a singleton instance of the Prisma client:\n\n```typescript\nimport { PrismaClient } from \"@prisma/client\";\n\nconst globalForPrisma = global as unknown as { prisma: PrismaClient };\n\nexport const prisma =\n  globalForPrisma.prisma ||\n  new PrismaClient({\n    log: ['query', 'info', 'warn', 'error'],\n  });\n\nif (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;\n```\n\n## Learn More\n\nTo learn more about Next.js, take a look at the following resources:\n\n- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.\n- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.\n\nYou can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!\n\n## Deploy on Vercel\n\nThe easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template\u0026filter=next.js\u0026utm_source=create-next-app\u0026utm_campaign=create-next-app-readme) from the creators of Next.js.\n\nCheck out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsidh%2Fredx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsidh%2Fredx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsidh%2Fredx/lists"}