This is a Next.js project bootstrapped
with create-next-app
.
This is the demo project to apply to Remitano as Developer.
This is a simplified Youtube video sharing social site, with some key features:
- User registration and login
- Share Youtube video
- View a list of everyone shared videos
- Docker
- Docker Compose
- Node LTS v18
- Prisma credentials for a PostgesSQL database. (Or use the example
.env.sample
file)
- Ensure you have Docker installed and working.
- Clone the repo to your folder, for example:
~/renec
cd ~/renec
- Install deps by running
npm install
- Create an
.env
file at root folder and put your Prisma creds inside:touch .env
- Or, use the sample provided database:
cp .env.sample .env
- Seed some data into the database if you use your own database setup:
npx prisma db seed
- Now you are ready to go. Run
npm run dev
to start the dev server. - Visit
http://localhost:3000
and voila!
There is also a Docker file setup if anyone want to run with Docker:
cp .env.sample .env
- Run
docker-compose up --build
and wait for it to complete - Now the Docker container is up and serve you at
http://localhost:3000
If you want to use your own Prisma database. Do this:
- Sign up for Prisma and spin up a PostgresSQL database instance.
- Create a .env file and put the configurations Prisma give to you.
- Run the command to init the db:
npx prisma generate
&&npx prisma db push
- Run the command to seed the new db
npx prisma db seed
- Start the dev server if you haven't yet:
npm run dev
- Visit
http://localhost:3000
and the Homepage will appear - Run
npm run test
to run full test suite
- The Homepage contains the big main part listing out all shared videos in the system.
- On the top right corner is the login/register form.
- Enter an email and a password and click "Register" button and your account will be created immediately. The system will also log you in automatically.
- Or, to login using existing account: enter the email and password and click "Login" button, and the system will log you in. Otherwise, an alert will pop out telling you what went wrong.
- Once logged in, the top-right corner will turn into My Account section, telling you your email, as well as allowing you to share a video or logout of the system.
- Click on the button "Share a movie" and the Sharing form will appear under.
- Or, click on "Logout" button and you are out!
- To Share a video, in the Share form, paste your Youtube link (for example: https://www.youtube.com/watch?v=l9-KNJTc_UU) into the input and click "Share".
- If success, then you are back to the main screen and the newly shared video will appear at the top of the list.
- Otherwise, an alert will pop out telling you what went wrong.
- npm install failed: You might have permission issue with your Node installation. We recommend using NVM to install and manage Node installation on the machine.
- no data: You forgot to run the seeding process on your new fresh database instance! Go back to the Database Setup section and follow the instructions.
- port conflict: by default, dev server will be using port 3000. If any other guy is using it, then the
command
npm run dev
will be upset and complain a lot. Terminate any other process that is locking port 3000 and try again.