This is my study project: a web-application where everyone can publish useful ChatGPT prompts.
- React 18
- NextJS 13 (using App Router paradigm)
- MongoDB, Mongoose
- Tailwind (shipped with NextJS), PostCSS
- Node.js Version 16.8 or later
- NextJS Version 13 or later
- Clone the repository to your local machine.
- Navigate to the project directory.
- Install the required dependencies by running
npm install
. - Start the development server by running
npm run dev
. Alternatively, you can useyarn dev
orpnpm dev
. - Open your browser and navigate to
http://localhost:3000
to see the application in action.
- generate Client ID and Client secret
- add Authorized JavaScript origins
- http://localhost:3000
- yourapp.vercel.app (if you use Vercel)
- add Authorized redirect URIs
- http://localhost:3000
- http://localhost:3000/api/auth/callback/google
- if you use Vercel
- yourapp.vercel.app
- yourapp.vercel.app/api/auth/callback/google
- generate MongoDB URI
- add the role readWriteAnyDatabase@admin to your cluster
- add 0.0.0.0/0 to allowed IP addresses
- Open .env
- Set
- GOOGLE_ID
- GOOGLE_CLIENT_SECRET
- MONGODB_URI
- NEXTAUTH_URL to http://localhost:3000
- NEXTAUTH_URL_INTERNAL to http://localhost:3000
- NEXTAUTH_SECRET. You can quickly create a good value on the command line via this openssl command:
$ openssl rand -base64 32
The easiest way to deploy this Next.js application is by using the Vercel Platform, created by the makers of Next.js. Check out the Next.js deployment documentation for detailed instructions.
If you use Vercel, please change values of NEXTAUTH_URL
, NEXTAUTH_URL_INTERNAL
and 'NEXT_PUBLIC_API_URL' to yourapp.vercel.app in "Environment variables" tab in the project settings on Vercel dashboard.
- The feed on the homepage might show stale data #6 (comment)