{"id":32512846,"url":"https://github.com/barbaraeguche/pawsitive","last_synced_at":"2026-04-11T17:41:42.326Z","repository":{"id":272851862,"uuid":"889199733","full_name":"barbaraeguche/pawsitive","owner":"barbaraeguche","description":"🐾 a friendly pet adoption application built with nextjs.","archived":false,"fork":false,"pushed_at":"2025-10-16T23:40:31.000Z","size":2047,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-03T16:30:34.906Z","etag":null,"topics":["framer-motion","next-auth","nextjs","pets","postgresql","prisma","vercel","zustand"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/barbaraeguche.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-15T20:02:20.000Z","updated_at":"2025-12-21T20:27:49.000Z","dependencies_parsed_at":"2025-03-21T19:38:40.307Z","dependency_job_id":"7313468a-b879-4e01-9a5b-28c0f5cc931d","html_url":"https://github.com/barbaraeguche/pawsitive","commit_stats":null,"previous_names":["barbaraeguche/paw-squad","barbaraeguche/pawsquad","barbaraeguche/pawsitive"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/barbaraeguche/pawsitive","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barbaraeguche%2Fpawsitive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barbaraeguche%2Fpawsitive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barbaraeguche%2Fpawsitive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barbaraeguche%2Fpawsitive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barbaraeguche","download_url":"https://codeload.github.com/barbaraeguche/pawsitive/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barbaraeguche%2Fpawsitive/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31554091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T10:21:54.569Z","status":"ssl_error","status_checked_at":"2026-04-08T10:21:38.171Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["framer-motion","next-auth","nextjs","pets","postgresql","prisma","vercel","zustand"],"created_at":"2025-10-27T22:46:59.487Z","updated_at":"2026-04-08T11:32:29.470Z","avatar_url":"https://github.com/barbaraeguche.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pawsitive 🐾\na pet adoption platform where users can adopt and rehome pets seamlessly. \nit features authentication, session management, and state management to ensure a smooth user experience, \npowered by prisma db for efficient data handling.\n\n## tech stack ✨\n- **frontend:** built with nextjs, tailwind css, framer motion, and zustand for state management.  \n- **backend:** powered by nextjs with prisma and postgresql for database management.  \n- **deployment:** hosted entirely on vercel.\n\n## features 👾\n- **pet care tips:** provides useful tips on how to take care of adopted pets.\n- **adopt and rehome pets:** users can adopt up to 4 pets and rehome up to 6 pets.\n- **authentication and authorization:** next-auth credentials authentication with cookies set to expire after 15 minutes. authorization is required for adoption, rehoming, and account pages.\n- **adoption and rehoming history:** track pets you've adopted or rehomed.\n- **restrictions:** users cannot adopt a pet they rehomed.\n- **state management:** global state management using zustand that triggers a fetch request for available pets when adoption occurs.\n- **automatic session expiry:** logs users out after 15 minutes of major inactivity.\n\n## what I learned 💭\n- **multipage website development:** learned how to build and structure a website with multiple pages.\n- **authentication and authorization:** implemented next-auth credentials authentication, cookies, and authorization for secure access.\n- **shadcn usage:** explored and utilized shadcn for UI components.\n- **global state management:** managed state effectively using zustand.\n- **form validation:** applied zod schemas for form validation.\n- **middleware and configuration:** set up middleware, auth.config, and authentication workflows.\n\n## limitations 🚨\n- **pet options:** currently only supports cats and dogs that are at least a month old (due to zod validation). \n- **layout constraint:** does not take up full browser width (maximum width of 2000px). \n- **authentication providers:** does not support third-party login providers like github or google.\n\n## improvements 🌱\n- **payment integration:** add real-time payments (e.g., stripe) for adoptions.\n- **customer support:** implement a contact system for better user satisfaction and faster service.\n- **authentication upgrades:** email verification, support additional login providers and a \"remember me\" feature.\n\n## session expiry hook 🪝\nthis hook ensures users are automatically logged out 15 minutes after **every** reload.\n```typescript\n'use client';\nimport { useSession, signOut } from 'next-auth/react';\nimport { useEffect, useCallback, useMemo } from 'react';\n\nexport const useSessionExpiry = () =\u003e {\n  const { data: session, status, update } = useSession();\n\t\n  const handleLogout = useCallback(async () =\u003e {\n    await signOut({ redirectTo: '/' });\n  }, []);\n\t\n  // ensure session gets refreshed if unauthenticated\n  useEffect(() =\u003e {\n    if (status === \"unauthenticated\") {\n      update().catch(console.error);\n    }\n  }, [status, update]);\n\t\n  // compute session expiry time efficiently\n  const timeUntilExpiry = useMemo(() =\u003e {\n    if (!session?.expires) return null;\n    return new Date(session.expires).getTime() - Date.now();\n  }, [session]);\n\t\n  useEffect(() =\u003e {\n    // if no valid expiration timestamp, do nothing\n    if (timeUntilExpiry === null) return;\n\t\t\n    // if the session already expired, log out immediately\n    if (timeUntilExpiry \u003c= 0) {\n      handleLogout();\n      return;\n    }\n\t\t\n    // set a timer to log the user out when the session expires\n    const timer = setTimeout(handleLogout, timeUntilExpiry);\n\t\t\n    // cleanup the timer if the component unmounts or session changes\n    return () =\u003e clearTimeout(timer);\n  }, [timeUntilExpiry, handleLogout]);\n};\n```\n\nthe provider wraps the entire application to enable session tracking and automatic logout.\n```typescript jsx\n'use client';\nimport { SessionProvider as NextAuthSessionProvider } from 'next-auth/react';\nimport { ReactNode } from 'react';\nimport { useSessionExpiry } from '@/hooks/useSessionExpiry';\n\nfunction SessionExpiryCheck() {\n  useSessionExpiry();\n  return null;\n}\n\nexport function SessionProvider({ children }: {\n  children: ReactNode\n}) {\n  return (\n    \u003cNextAuthSessionProvider\u003e\n      \u003cSessionExpiryCheck/\u003e\n      {children}\n    \u003c/NextAuthSessionProvider\u003e\n  );\n}\n```\n\n## .env file 📄\nthis project requires an `.env` file in the root directory. rename the `.env.example` file to `.env`, and update it with the necessary values. ensure this file is configured properly and not committed to version control.\n\n## running the project 🏁\nto get the project up and running on your local machine, follow these steps:\n\n- **ensure [node.js](https://nodejs.org/en) is installed:** this project uses node v22\n- **clone the repository:**\n```bash\ngit clone https://github.com/barbaraeguche/pawsitive.git\n```\n- **navigate to the project directory:**\n```bash\ncd pawsitive\n```\n- **install dependencies:**\n```bash\npnpm install\n```\n- **run the project:**\n```bash\nnext dev\n# or\npnpm run dev\n```\n- open [http://localhost:3000](http://localhost:3000) with your browser to see the result.\n\n## preview 📸\n**login + account page:**\n\nhttps://github.com/user-attachments/assets/1dd09464-317f-4420-9d65-037ca88794e9\n\n**rehoming:**\n\nhttps://github.com/user-attachments/assets/49e368ec-9243-403c-b653-ac64af04c26b\n\n**adopting:** [Watch the video here :)](https://youtu.be/aQ7MYwd1sK8)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarbaraeguche%2Fpawsitive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarbaraeguche%2Fpawsitive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarbaraeguche%2Fpawsitive/lists"}