TRANSCRIPTEnglish

How To Create Full Stack Text to Image Generator AI SaaS App Using React JS | MERN Project

6h 54m 58s51,745 words7,961 segmentsEnglish

FULL TRANSCRIPT

0:00

hello and welcome to another exciting

0:02

tutorial of great stack in today's video

0:05

we are going to build a full stack image

0:08

generator AI SAS application using

0:11

mongod DB Express react and nodejs so

0:16

let's see the project overview that we

0:18

are going to create in this tutorial so

0:21

this is the homepage where you can see

0:24

we have added the navigation bar with

0:26

logo and this login button then we have

0:29

these text and you can see these

0:31

contents are animated here we have this

0:34

button to generate the image using the

0:37

text prompt if I scroll down here we

0:40

have some steps to generate the image

0:43

then we have the description and then we

0:46

have the customer

0:48

testimonials after that we have another

0:50

button to generate the image and then we

0:53

have this footer so this is the homepage

0:57

and if I click here it will open the

1:00

price plan page so that user can buy

1:03

credits to generate the image after that

1:06

here we have the login button so let me

1:08

click on this login button so here we

1:10

have the option to login on this

1:12

application or we can use this sign up

1:15

link to open the signup form and user

1:17

can create an account on this

1:19

application so I already have an account

1:22

so I'll click here on login so I have

1:25

added the email ID and password and

1:27

click on the login button now we are

1:29

logged in let me go to

1:31

homepage so in this navigation bar you

1:34

can see it is displaying my name also hi

1:37

Greatest Tag then we have this user icon

1:39

and we have the logout button and here

1:42

in this navigation bar you can see the

1:44

credits left so right now two credits

1:47

are left so whenever you will create a

1:49

new account you will get five credits so

1:52

I have already used this credits to

1:54

generate the image so to generate the

1:57

image just click on this button

2:00

so it will open this page and here we

2:03

have the input field and in this input

2:05

field you can add any text to generate

2:09

the image using the text so in this one

2:12

let me add one prompt I will type a 3D

2:16

render of a small chibi style tiger in

2:20

forest and click on this generate button

2:23

so you can see the loading text here and

2:27

after completing this loading you will

2:29

see a AI generated image so now you can

2:34

see the image has been generated we can

2:37

also download this image using this

2:39

button so let me click here so this

2:41

image has been downloaded so our image

2:44

has been downloaded that we have

2:46

generated using text prompt now let me

2:49

generate another image so I'll click on

2:51

this button generate another and here

2:54

let me add the another prompt

2:57

so let me add 3D render of a small chv

3:01

style tiger in snow and click on this

3:05

generate button now our image has been

3:08

generated a tiger in snow and right now

3:11

you can see our credit is zero if I try

3:14

to create another image let's click on

3:17

this button generate another and here if

3:21

I type wolf in snow click on generate

3:25

button you can see we are getting the

3:28

notification no credit back balance and

3:30

we are rected to the payment page so now

3:33

we can buy more credits to generate more

3:36

images so let me choose any of this plan

3:39

so let's select the first one it will

3:42

give 100 credits we'll click on this

3:46

button and here we have added the

3:48

reserve pay payment gway so it is

3:50

opening this payment page and here we

3:52

have to add the card number so let me

3:54

add the card number and other details

4:00

now we have made the payment

4:01

successfully and after making the

4:03

payment you can see here we have the

4:05

notification createit added and in this

4:07

S Bar you can see the credit left 100 so

4:10

we have purchased the 100 credit now

4:13

again we can generate the image so let's

4:16

click on this generate button and here

4:18

we will add new prompt so let's add a 3D

4:22

tender of a small chibi style wolf in

4:26

snow click on generate button and you

4:29

can see the text

4:31

loading now you can see our image has

4:33

been generated so we will create this

4:36

full stack text to image generator AI

4:39

SAS application using mongod DB Express

4:43

react and nodejs step by step but before

4:47

we dive in I would like to thank our

4:50

video sponsor codex codx enables you to

4:55

build and deploy your react application

4:57

visually with just a few clicks with

5:01

codu you can create a complete react

5:03

application from a scratch or import an

5:06

existing react project you can also

5:09

start with beautiful pre-built templates

5:13

provided by codu that comes with many

5:16

reusable components making it easy to

5:18

build complex UI in less time it

5:22

provides visual tools to design Pages

5:25

create components and as style them

5:28

easily codu also integrates smoothly

5:32

with Wix headless services like its

5:35

e-commerce service powering over a

5:37

million online stores or any other

5:40

custom backend service that allows you

5:42

to build a fully functional react

5:45

application without hassle you can open

5:48

and edit code files in your favorite IDE

5:51

such as VSS code while previewing

5:53

changes in codu in real time plus you

5:56

can connect your project to GitHub to

5:59

collaborate seamlessly with other

6:01

developers to get started with codex

6:04

click the link in the description below

6:06

now let's start to create our text to

6:10

image generator project for that let's

6:12

come to desktop screen and here I will

6:15

create a folder so let's create a new

6:18

folder and I'll write the folder name

6:20

imagify that is our project

6:23

name now let me open this folder with vs

6:27

code editor so right click select open

6:30

with

6:33

code now our project folder is open in

6:38

vs code which is

6:40

imagify in this folder we have to create

6:43

two folders that will be for front end

6:45

and back end so first we will create the

6:48

front end so in this one let's create a

6:51

new folder and write the folder name

6:55

client where we will create the front

6:58

end application

7:00

now right click on this client folder

7:02

and select open in integrated

7:06

terminal so you can see in this terminal

7:09

we are in the imagify and client folder

7:13

now in this client folder we have to

7:15

create the react project using wheat

7:18

package so just

7:20

add npm create wheat at

7:27

latest so we have added npm create we at

7:31

latest press

7:34

enter so it will create a react project

7:38

here it is asking for the project name

7:40

so just add dot so it will create the

7:44

project with the name client press

7:47

enter here we will select

7:50

react then select

7:53

JavaScript after that we have to install

7:55

the dependencies for that just add end

7:59

PM

8:02

install press

8:09

enter after completing npm install let

8:12

me expand this client folder from the

8:15

left sidebar and you can see in this one

8:17

we have nodecore modules folder and we

8:20

have these

8:22

files right so now we have created the

8:25

react project to start this project we

8:27

will use npm run

8:32

Dev so in this terminal we have added

8:35

npm run Dev and press

8:40

enter so our project is running on this

8:43

URL Local Host Port 5173 so just open

8:47

this URL in any web

8:50

browser so now you can see our basic

8:53

react plus wheat project is running in

8:56

the web

8:58

browser next we have we have to clear

9:00

this default

9:01

project so let's come back let me hide

9:05

this

9:06

terminal and in this SRC you will

9:10

find app. CSS so right click and select

9:17

delete after that we will open

9:21

app.jsx just open this one and we will

9:25

clear this file and here we will use RAF

9:29

C

9:31

snipet and press enter so it will create

9:34

this functional react

9:37

component if this rafc snippet is not

9:41

coming for you then you have to install

9:43

one extension just go to extensions and

9:46

here search for

9:49

es7 react

9:51

Redux you can see it has 2 million

9:54

installs so you have to install this

9:56

extension then you can use the ra f c

10:01

snipet after that let's go

10:05

to index. CSS and we will clear this

10:08

file also next just go to

10:12

index.

10:14

HTML and here you can see we have the

10:16

title right so in this one we will

10:19

update the website title so it is

10:25

imagify Das greatest stack

10:30

after adding this if I come back to the

10:31

web page here you can see our project is

10:34

cleared and in this browser title you

10:38

can see imagify Greatest Tag next we

10:41

have to update this icon that is the

10:44

favicon icon you can see in the browser

10:46

tab so to replace this icon we have to

10:50

add the images and icons in our project

10:54

so let me just come back to the desktop

10:56

screen and here I have one folder called

10:59

asss you will find this folder download

11:02

link in the video description let me

11:05

open it so in this one we have some

11:07

icons images and one assets. JS file so

11:12

let me just copy

11:14

everything from

11:16

here and open our project

11:20

folder in the project folder you can see

11:22

we have the client then SRC and in this

11:26

one we have the assets so in this assets

11:30

just paste all the images icons that we

11:33

have just

11:35

copied correct now close it and come

11:39

back to the vs code so now in the left

11:42

side bar you can see we have

11:45

the assets folder expand it and in this

11:49

assets you can see we have all the icons

11:53

correct and in this one we have one

11:55

favicon do SVG also so we have to move

11:58

this favicon on. SBG we will paste it in

12:02

the public folder so let me just come

12:05

back to the project folder again and go

12:07

to client SRC assets and from here just

12:12

find picon SVG it is here just remove it

12:16

from

12:17

here and uh we will add it in the public

12:22

folder in this client folder you can see

12:25

public just paste it here and remove

12:28

this v.s

12:30

V after that if I come back to the VSS

12:34

code here you can see we have assets. Js

12:37

file also that you will get in the

12:41

assets folder so in this one I have

12:43

imported all the

12:46

images then I have created one object

12:49

called assets and using this object I

12:52

have exported all the images using this

12:55

export keyword so that we can easily use

12:58

the images in any component by using

13:00

this

13:02

object we don't have to add the Importer

13:04

statement for each image we will just

13:07

use the assets and we will use the image

13:12

after that we have the steps data that

13:15

we will use on our web page we will

13:18

display these data from this aray after

13:21

that we have one more aray called

13:24

testimonials data so in this are we have

13:27

added different object and each object

13:30

is representing one testimonial so we

13:32

will display these testimonial data on

13:34

our web

13:35

page after that we have plans here we

13:39

will create the price plan page so on

13:41

that page we have to display different

13:43

plans so here I have added one aray and

13:46

in this aray we have three object that

13:50

represents three different price plan so

13:54

let me just close this and uh close this

13:58

assets also and in this public we have

14:00

fabicon SVG so in this index.html file

14:05

here we have the link tag and in this

14:07

link tag we have v.svg

14:11

right so instead of this v.svg we will

14:15

add favicon do SVG that we have added in

14:19

the public folder save the changes come

14:22

back to the web page now you can see the

14:24

updated icon in this browser title so we

14:28

have updated the

14:31

favicon after that we have to create the

14:33

folder structure for our project for

14:37

that just come

14:38

back and in the left side

14:41

bar here we

14:43

have client folder in this client folder

14:47

we have SRC now within this SRC we will

14:51

create a

14:52

folder called

14:57

components so so we have created

15:00

components folder where we will create

15:02

different

15:03

components after that in this SRC folder

15:06

right click and select new folder and

15:09

here we will create a folder called

15:12

pages so in this one we will create

15:15

different

15:16

pages and in this SRC folder let's add

15:21

one more new folder and the folder name

15:24

is

15:26

context in this context folder we will

15:29

create a context file where we will

15:32

store all the states for this

15:35

application so we have created the

15:37

folder

15:39

structure now after creating the folder

15:41

structure we have to add the telin CSS

15:44

in this project to add the twiin CSS

15:48

just come back to the web browser open a

15:51

new tab and here we will search

15:54

for V plus tnd CSS

16:03

open this first

16:06

link and here we have the steps to

16:09

install telin CSS in whe project so you

16:14

can see the first step create your

16:17

project that we have already created the

16:19

next step is install telin CSS so here

16:23

we have two commands right so let me

16:25

just copy it one by one just copy the

16:28

first one come back to the VSS

16:30

code and just open the terminal

16:35

again so here we have the terminal right

16:39

so in this terminal we have to add

16:40

control C so it will stop the

16:43

project now paste the command that we

16:46

have just copied npm install and this

16:49

one press

16:53

enter after that let's copy the second

16:57

command and paste it here press

17:03

enter after completing it you will see

17:06

uh new file in this sidebar you can see

17:10

post css. config.js and one more file is

17:14

there Telvin config JS it means T.C

17:19

config.js

17:21

now just come back here and you can see

17:24

the third step configure your template

17:27

paths for that

17:29

just copy this entire code click here to

17:32

copy and go to T.C config.js

17:35

file so from this left side bar we will

17:38

open telin config

17:40

JS

17:41

and replace the code here just remove

17:45

everything from here and paste the code

17:47

that we have just copied save the

17:50

changes after that you can see the next

17:53

step is to add these lines in index. CSS

17:56

file so just copy it and and come back

17:59

open index. CSS where it is it is here

18:03

index. CSS and paste

18:07

it after that let's see the next step so

18:10

the next step is to start our project

18:13

using npm run Dev that's it and now we

18:17

can easily use the telin classes in any

18:21

HTML

18:22

element now let's close it and come back

18:25

to the vs code and here we can start our

18:28

project

18:30

using this terminal but before starting

18:32

this project we will install one more

18:35

dependencies in this project we have to

18:37

create multiple Pages like

18:40

homepage and uh price plan page then we

18:43

will display the result page so to

18:46

create multiple Pages we have to add the

18:49

react router so to add the react router

18:52

we will add the dependencies called

18:56

react router Dom so just add

18:59

npm

19:02

install

19:04

react router

19:08

Dom then press

19:11

enter and after that we will start our

19:14

project using npm run

19:17

Dev use this npm run Dev press

19:22

enter now again our project is running

19:25

on same URL now we will hide this

19:29

terminal come back to the web page and

19:32

you can see our web page is running and

19:34

it is completely

19:36

blank next let's see the figma design

19:39

what we have to create so let me open

19:42

the figma file in the new

19:47

tab here you can see we have four pages

19:50

in this application let me zoom in so

19:54

this is the homepage right in this

19:57

homepage we have to create this navig

19:58

ation bar with logo these buttons and

20:02

these featured text then some small

20:05

images then we have these steps how it

20:09

works then we have this description area

20:13

then we have testimonials and one button

20:15

and one footer so this is the homepage

20:18

then let's see the other page this is

20:20

the result page so that whenever we will

20:23

enter any prompt we will see this page

20:26

with our AI generated image next we have

20:29

to create this price plan page and then

20:32

we'll create this login sign up

20:35

component correct so let's start with

20:37

the first one so to build this homepage

20:41

first We'll add the Google font in our

20:44

project so that we can use this font

20:47

right so let's open a new tab and search

20:50

for outfit

20:55

font open this website fonts. go

20:59

google.com

21:05

outfit and just click on this button get

21:10

font now you can see this button get

21:13

embed code just click

21:16

here from here just click on this import

21:19

option and you will get this import link

21:22

just copy it and uh come back to the vs

21:27

code in this vs code just open index.

21:31

CSS

21:33

file and paste it at the top so we have

21:38

added this import statement correct

21:40

after that we have to add the font in

21:43

all the elements so just add the aster

21:46

symbols or start here we will add the

21:50

font family and write the font

21:53

family outfit that's it so by default

21:58

this outfit font will be applied in all

22:00

the

22:02

elements close it come back to the

22:06

browser close this tab also and now

22:10

let's start by building this

22:13

homepage so let's come

22:16

back we will come back to the vs code

22:20

editor and uh let's close this file also

22:24

and in this Pages folder we will create

22:27

three files

22:29

right so in this pages right

22:32

click and select new file and write the

22:35

file

22:36

name

22:38

home.

22:40

jsx the file name should start with the

22:43

capital name you can see I'm using

22:45

Capital H here we will add

22:49

RFC and in this one we will add the text

22:52

called

22:53

home within this div now let's go to

22:57

Pages folder again right click and

22:59

select new file here we will add the

23:02

file name by

23:06

credit do

23:09

jsx WR our

23:11

AFC here we will

23:13

add by

23:16

credit now right click on the pages

23:18

folder select new file and write the

23:20

file name

23:25

result do jsx

23:29

here we will add

23:32

rafc and write the text

23:36

here result

23:41

page that's it next we have to mount

23:44

these pages on app.jsx file so just open

23:50

app.jsx and here you can see we have

23:54

this div right so inside this div we we

23:58

have to add the routing and based on

24:00

routing we will display different pages

24:03

so for now let me add all the pages just

24:07

add opening

24:09

Arrow home select this from this

24:13

suggestion pages slome so you can see

24:17

this home component or home page has

24:19

been

24:21

imported close this tag now we will add

24:28

result select this from the

24:32

suggestion it has been imported now we

24:35

will add the third

24:37

page by

24:40

credit so by credit has been imported

24:44

save the changes and if I come back to

24:46

the web

24:48

page and here you can see we have

24:51

home result page and Buy credit because

24:55

we have mounted all the pages in this

24:58

app component correct next we have to

25:01

display different pages based on

25:03

different route for that we will set up

25:06

the react router so to set up the react

25:09

router first we will go to main. jsx

25:13

file and in this one just remove this a

25:16

strict

25:19

mode and before this app component let's

25:25

write browser router or let me import it

25:29

first so here after this react Dom

25:34

client let's add a space and here we

25:37

will

25:38

add import curly

25:42

Braes browser

25:47

router from react router Dom so we have

25:52

imported browser router from react

25:55

router Dom now we will use this

25:59

browser router before this app component

26:02

just add the opening

26:03

arrow

26:05

and add this tag and close this after

26:09

this app component so here we have the

26:12

opening tag and this is the closing tag

26:15

correct so now we have the support of

26:18

browser router in

26:20

the complete app component

26:24

correct after that let's go to app.js x

26:29

file and in this app.jsx file we have to

26:32

use the routes and Route so just import

26:37

that so here after this import react

26:42

let's

26:43

add

26:45

import

26:49

CES

26:52

routes comma

26:55

route

26:57

from react router Dom so we have

27:00

imported routes and route now using this

27:03

tag we will declare the routing path and

27:06

based on different routing path we will

27:08

display different pages

27:11

so in this div just add a space and here

27:16

we will add routes

27:18

tag use this routes

27:22

tag and move all the pages within this

27:28

routes now here just

27:33

add route use this route tag and this

27:38

route will be self closing like this let

27:42

me add a space so you can see clearly we

27:44

have added route and in this one we have

27:47

to declare the path so just add path and

27:50

the path will be slash that will be the

27:52

homepage so whenever the user will be at

27:56

SL path then we have to display the

27:58

homepage so just add element and in this

28:01

element just add the curly

28:04

bres and provide this home that's it

28:10

after that just duplicate this line here

28:12

we will add the path that is

28:17

result and from here remove this home

28:20

and here we will provide this result

28:24

page now duplicate this line and here we

28:26

will add buy or we can say Buy credit so

28:31

here remove this and within this we will

28:35

provide this by credit page now you can

28:39

see

28:40

clearly here we have one routes tag and

28:44

within this routes tag we have three

28:47

route and in each route we have added

28:50

different path this is the Home Path

28:52

this is the result and this is by path

28:55

here we will display homepage here we

28:57

will display result page and here we

28:59

will display Buy credit page so save the

29:02

changes and let's preview this changes

29:05

on web page so just open the web browser

29:08

and right now you can see we are at the

29:09

Home Path that's why it is displaying

29:12

home correct if I change the path so in

29:15

this URL if I type class

29:19

result so we have added Local Host 5173

29:23

SL result press enter now you can see

29:26

result page now if I add

29:31

Buy in this URL press enter now you can

29:35

see buy Creed it so this route is

29:37

working

29:38

fine correct so now we will start

29:42

building our homepage where you can see

29:45

home correct so right now it is

29:47

displaying home so let me add some cses

29:52

for this homepage so let me just come

29:55

back and uh here in this this app

29:58

component we will add some CSS that will

30:00

be applicable for complete application

30:03

so in this D let's add the class

30:07

name and here we will add the tent

30:10

classes now for the entire application

30:12

we will provide the padding from x-axis

30:15

it means padding left and padding right

30:18

so we will add the padding X for this is

30:22

for the Mobile screen now for the

30:25

smaller screen we will increase the

30:27

padding so it is is padding

30:29

X10 now for the medium screen we will

30:32

further increase the padding so we will

30:35

add MD colum padding X and it will be 14

30:41

now we will further increase the padding

30:43

for larg screen so just add LG and PX

30:49

28 that's it next we have to define the

30:52

minimum height of the application so

30:56

here we will add

30:59

Min

31:01

H

31:03

screen so here we are using these tnd

31:06

classes if you don't know about the tnd

31:09

I have a dedicated video about tnd where

31:12

you can learn the tnd CSS from beginning

31:15

I will provide that tutorial Link in the

31:18

description after this mean height

31:21

screen here we will change the

31:23

background color of the application and

31:26

in the application we will add the

31:28

gradient color in the background so just

31:30

add

31:31

BG

31:33

gradient

31:35

and to bottom so just add BG gradient 2

31:39

B it means to

31:42

bottom and here we have to provide two

31:45

color code so let's add the first color

31:47

code that is

31:51

from till

31:55

50 and now we'll add the second color

31:58

code with two so

32:01

two orange

32:04

50 so we have added this first color

32:07

code and second color code for the

32:09

gradient

32:11

background after adding this just come

32:13

back to the web page here you can see we

32:17

have some color in the background and

32:19

this is the gradient color

32:22

correct now let's come

32:25

back and in this figma design you you

32:28

can see here we have the navigation bar

32:29

in the homepage also then we have this

32:33

navigation bar in the result page also

32:36

and then this navigation bar in

32:39

this price plan page also so we have to

32:42

add the navigation bar in all pages for

32:46

that we have to place the navigation bar

32:48

in the app component so you can see we

32:52

have added

32:53

this app component in this app.jsx file

32:57

so before this routes we will provide

32:59

the navigation bar so that this

33:01

navigation bar will be visible in all

33:04

pages so first we have to create the

33:06

navigation component so here we have the

33:09

components folder so right click here

33:11

and here we will select new file and

33:13

write the file name

33:18

navard do

33:22

jsx and here we will use

33:24

RFC and here let's add the text

33:30

navigation bar save the changes and come

33:34

back to the

33:35

app.jsx and before this routes let's add

33:40

Navar select it from the suggestion so

33:43

the Navar has been imported correct

33:47

close this

33:49

tag so we have added this Navar save the

33:52

changes come back to the web page and

33:54

you can see we have the navigation bar

33:56

on homepage correct if I go to other

33:58

page

34:00

like bu credit here also we can see

34:03

navigation bar and then bu credit page

34:06

if I go to result page like this here

34:10

also you can see the navigation bar and

34:11

this result page so we have added this

34:14

navigation bar component in all the

34:16

pages so next we have to design this

34:19

navigation bar so just come back and uh

34:23

go to navb bar. jsx file

34:28

in this Navar component let me remove

34:30

this text and here we have this div So

34:35

within this div we have to add One logo

34:38

in the left side and we will add some

34:40

buttons and text in the right side So

34:44

within this div let's add the

34:48

image using the IMG tag and in this SRC

34:52

we have to add the image so we will get

34:56

the image from assets object that is

34:59

stored in the assets. JS file so first

35:04

we have to import that so here we will

35:06

add

35:08

import

35:11

CES

35:12

assets

35:14

from double

35:16

do/ assets folder assets

35:20

file now in this curly assess we can use

35:24

assets Dot and we can access any image

35:28

using this dot so let's add the image

35:30

name

35:33

Logo now for this image we have to add

35:36

some CSS properties so just add the

35:39

class name property and here we will

35:41

provide the classes so just add the

35:43

width 28 then we will add different

35:46

width for small device so just add

35:50

SM width

35:54

32 after that we'll add different width

35:56

for largest screen so just add LG then

36:00

width

36:02

40 save the changes if I come back to

36:05

the web page here you can see we have

36:07

this logo right now just come back and

36:12

on this image we have to add the click

36:14

feature so that whenever we will click

36:17

on the logo it will redirect us to the

36:19

homepage so to add the click feature

36:22

here we will add the link tag provided

36:24

by the react router Dom so here just

36:30

add opening

36:32

Arrow link select this from the

36:35

suggestion react router Dom so the link

36:39

has been

36:41

imported now just close this

36:45

tag and move this closing tag after

36:49

this IMG so you can see I have wrapped

36:54

this IMG tag using this link tag link

36:56

opening and Link closing tag in this

36:58

link tag we have to provide the two

37:00

property and here in this two we will

37:03

provide the path so just add forward

37:05

slash that will open the

37:07

homepage that's it after closing of this

37:12

link tag here just add the space and

37:14

here we will add the

37:15

div and in this div we will add the

37:18

content for the right side of the

37:21

navigation bar so if I go to the web

37:24

page and let's open the figma design

37:28

so in this design you can see we have

37:30

this navigation bar where you can see

37:32

the price and log out button in the

37:34

right side but if I go to different page

37:39

like this here you can see I have added

37:41

different buttons in the navigation bar

37:43

which is creit left then name and then

37:47

icon and whenever we will hover on this

37:49

icon it will display one logout button

37:53

so we have different content in the

37:55

right side of the navigation bar it is

37:58

because suppose user is logged out then

38:02

we have to display

38:03

these link pricing and login button and

38:07

if the user is already logged in then we

38:11

will display the users name icon and

38:15

available credit that's why we have

38:18

added different buttons in the

38:20

navigation bar so to display these

38:23

information we will create two div so

38:25

just come back to the vs code

38:28

and within this div let's

38:31

add div for the user which is logged out

38:36

user and here we will add one more div

38:39

this one this is for the logged in user

38:43

correct now we have to get to know

38:46

whether the user is logged in or logged

38:48

out for that here we will create one

38:51

state variable so before this return

38:54

just

38:55

add const

39:00

user set

39:03

user is equal to user

39:08

State and here we will add null so

39:12

initialize it with null it means the

39:15

user is logged out and when it is true

39:19

it means the user is logged in so here

39:23

we will add the turn operator so just

39:26

add the curly Braes and we'll write

39:31

user so if the user is available it

39:34

means if it is

39:36

true then what will happen we have to

39:39

display this

39:42

div correct and if the user is not

39:46

available it means user is logged out

39:49

then we will display this

39:52

div

39:54

correct so now you can understand the

39:57

erary operator if user is available then

40:00

the first div will be displayed and if

40:02

the user is not available then the

40:04

second div will be available so in the

40:07

second div we will add the button called

40:09

login and in the first div we will add

40:12

the details like users name we will

40:15

display the credit and we will add the

40:18

log out option also correct so now let's

40:22

start by adding content in this second

40:25

div because right now we have added null

40:27

it means the user is logged out so in

40:30

this second div we will add one text in

40:35

P tag so just add the P tag and here we

40:37

will add the text called pricing and

40:41

after that we will add the button so in

40:44

this button let's add the text

40:48

login save the changes come back to the

40:50

web

40:52

page here you can see we have the

40:54

pricing login and this home let me

40:57

remove this home

40:59

from home. jsx file let's come back and

41:03

remove this home and let's come back to

41:05

the navb bar. jsx file and we will add

41:09

the CSS properties in this first

41:11

div so in this first div let's add the

41:14

class name property and we have to align

41:16

the content side by side so for that we

41:19

have to use the flex layout so just

41:23

add

41:26

Flex item

41:29

Center justify

41:31

between and we will add the padding in y

41:35

AIS now you can see the logo in left

41:39

side and these text in the right side

41:41

pricing and

41:43

login now just come

41:45

back and uh here we have this

41:49

div correct so in this one we will add

41:52

the class name property here also we

41:54

will add

41:56

Flex I item

41:58

Center and we will provide the Gap two

42:02

then we will increase the gap for small

42:05

device so just add Gap

42:09

five now you can see these text are side

42:13

by side and here we have the Gap also

42:17

next we will add the CSS properties in

42:19

this button and let's add the CSS

42:22

properties in this pricing also so just

42:24

come

42:25

back and in this P tag let's add the

42:28

class name property and here we will add

42:32

the cursor

42:34

pointer correct and in this button we

42:38

will add the class name property and

42:41

here we have to change the background

42:43

color so just add

42:47

BG Jin

42:49

800 so it will be a dark background

42:52

color now we will add

42:54

the text White

42:58

after that we have to add the

43:01

padding then padding from five

43:06

AIS then we'll add different padding for

43:10

smaller

43:11

screen

43:13

py2 it will be

43:16

px2 after that we will add text a

43:20

small rounded

43:24

full after adding this if I come back to

43:26

the page you can see we have some

43:29

changes in this button but it is not

43:31

looking good so just come

43:33

back and uh

43:36

here let me add

43:41

px10 save the changes and come back to

43:44

the web page now this button is looking

43:48

good correct now we have to add the

43:53

click feature on this pricing link so

43:56

just come back and here here we have

43:58

this P right so on this one we have to

44:01

add the click feature so that whenever

44:03

we will click here it will open the

44:05

credit page so we have to import the

44:09

navigate from react router

44:13

Dom so before this return a statement

44:16

let's

44:17

add

44:19

const navigate is equal

44:23

to use navigate hook

44:27

from react router Dom you can see use

44:29

navigate has been imported from react

44:31

router Dom and now we can use this

44:35

navigate so scroll down and here on this

44:39

P tag we will add on click

44:43

property and in this onclick just

44:46

provide one Arrow

44:49

function and here just call the

44:53

navigate and in this one we have to

44:55

provide the path so just add forward

44:58

slash by that is the router path correct

45:03

now if I come back to the web page and

45:05

click on this pricing you can see it is

45:07

opening by credit

45:10

right and after that if I click

45:13

on Logo it will open the

45:17

homepage it's working next we have to

45:20

add these content which is createit and

45:25

this user name and this icon and we'll

45:29

add the log out link whenever we will

45:31

hover on this icon and it will be

45:34

displayed whenever the user is logged in

45:36

so just come back

45:38

and here inste of this null we will add

45:44

true correct and if I come back you can

45:47

see the right side is blank we don't

45:50

have anything in the right side so just

45:52

come back and here we have this first

45:56

div so whenever the user is available

45:58

this first di will be displayed so in

46:01

this one just add one

46:06

button and in this button we will add

46:09

the icon so just add the IMG tag and add

46:14

the curly Braes and in this curly Braes

46:17

we will add

46:18

assets dot createit a

46:22

star and for this button I mean for this

46:26

image we will add the class name so that

46:30

we can Define the width so we will

46:33

add width

46:35

five now after this icon we will add one

46:39

text also in this button so we will add

46:42

the text called credit

46:45

left like this and let me add any value

46:50

manually so let's add the credit left

46:54

50 correct now come back to the web page

46:58

and here you can see we have this icon

46:59

and this credit left

47:01

50 now just come back and after this

47:05

button we will add one text in P tag and

47:09

here we will add the users's name so

47:11

just add hi Greatest

47:15

Tag like this and after this text we

47:19

will add one profile icon and whenever

47:22

we will hover on that profile icon it

47:25

will display the log out button correct

47:30

so let's add one

47:33

div and in this div we have to add one

47:39

image and in this image we will add CES

47:46

assets

47:47

dot let's write user and after that we

47:52

will add class name properties so just

47:55

add the class name and here we will

47:57

Define the width so the width is 10 then

48:01

we will add

48:02

the drop

48:05

shadow correct and after this image

48:09

let's add one

48:14

div and here in this div we will add

48:17

class name property and this will be

48:22

absolute and in the parent div we will

48:26

add the class name property and it will

48:28

be

48:30

relative and on this one we have to add

48:33

the H effect also so here just add

48:36

group correct now in this div where we

48:40

have added the absolute this div will be

48:42

hidden by default so just add hidden and

48:46

after that it will be visible whenever

48:48

we will hover on the parent div so just

48:51

add group hover

48:57

and it will be block so that it will be

48:59

visible

49:00

again correct next we have to add the

49:03

positions so just add

49:05

top Zer then right zero then we will add

49:10

the Z 10 so that the Zed index will be

49:14

10 after that we have to add the text

49:17

color so the text will be black next we

49:20

will add

49:23

rounded and then we will add the padding

49:25

from Top that is

49:27

12 and inside this D we will add

49:32

the log out link so just add U Li and in

49:36

this Li we will add the log out text

49:41

like this save the changes come back to

49:42

the web page and here you can see we

49:44

have

49:45

this credit left High greatest stch and

49:48

we don't have any icon here so let me

49:51

just come

49:52

back go to Project folder

49:57

SRC assets and uh let me find the icon

50:02

so here we have the icon called profile

50:04

icon.png

50:07

so here we will

50:11

use assets

50:14

dot profile _ icon save the changes come

50:19

back to the web page now you can see

50:21

this profile icon also and if i h on it

50:24

here we have the log out you can

50:27

see when I hover on this profile icon we

50:30

are getting one log out link so next we

50:33

have to add CSS properties for the

50:35

content that we have added in the right

50:37

side so just come back here we have this

50:41

D that will be displayed whenever the

50:43

user is available so in this one just

50:45

add the class name property and here we

50:47

have to align the content side by side

50:49

so just

50:50

add flex and text Center then we will

50:54

add the Gap so just add the gap Gap two

50:58

and we'll increase the gap for smaller

51:00

screen so just add Gap

51:03

three correct now you can see it is

51:06

aligned side by side now just come back

51:09

and next we will add the CSS properties

51:12

in this button right so here in this

51:17

button we will add the class name

51:18

property and here let's add the same

51:21

thing Flex item

51:25

center after that we will add the Gap

51:28

two now we have to add the background

51:32

color so just

51:34

add BG blue

51:38

100 after that we have to add the

51:40

padding from

51:42

xaxis then we will add different padding

51:45

for the smaller screen

51:49

px6 then we will add the padding from y

51:51

AIS

51:54

1.5 and we will increase the padding for

51:57

a small width so just add

52:00

py 3 after that we have to add rounded

52:06

full next we will add the hover effect

52:09

so just add hover and here we will add a

52:13

scale it will

52:15

be

52:17

one5 then just add transition

52:23

all and dation simp

52:29

700 after adding this just come back to

52:31

the web page you can see this credit

52:34

left button is looking good and here we

52:36

have over effect also when I move cursor

52:39

on this one you can see the zoom in

52:41

effect

52:43

correct after that we will add the CSS

52:46

properties for this P tag so here just

52:51

add the class name and in this one we

52:53

have to add the text size so the text

52:56

will be extra small and for a smaller

52:59

screen we will add the text size a small

53:01

like

53:02

this and now we will add the font weight

53:04

so just add font

53:08

medium next we have to add the text

53:10

color so just add

53:13

text Gray

53:18

600 save the changes you can see this

53:21

text looks

53:24

good after that we have to add the C

53:26

properties for this textt where we have

53:28

added the users's name like I have added

53:31

High great stack so for this text just

53:35

add CSS properties in this P tag so in

53:38

this P just add the class name property

53:41

here we will add the same text color

53:45

that is here text Gray 600 then we'll

53:49

add the max a

53:52

small for the Mobile screen size we will

53:55

add hidden so it will be

53:57

hidden and then we'll add the

54:02

pl4 save the

54:04

changes now this text size is looking

54:07

good next we will add the CSS properties

54:10

for the users icon and for the logout

54:15

text that is displayed below this users

54:18

icon so just come back and here you can

54:21

see we have this div where we have added

54:24

relative and group and then we have this

54:27

image right and then we have this div

54:31

where we have added ul and lii so in

54:33

this UL we will add class name and for

54:37

this UL just add list

54:42

none then we'll add the

54:45

m0 and

54:48

P2 then we'll add background

54:52

white after that we'll

54:54

add rounded

54:57

medium then we'll add the

54:59

border and text a

55:04

small now in this lii tag we will add

55:07

the class name and here we will provide

55:11

padding from Y axis then padding from

55:14

xaxis then we'll add cursor

55:18

pointer and here we'll add the padding

55:21

from the right side 10 save the changes

55:25

come back to the web page now if I hover

55:27

on this profile icon here we have this

55:30

log out button correct right now when i

55:34

h on this one the entire navigation bar

55:37

is moving down so let me fix it here you

55:41

can see we have added the incorrect

55:43

spelling for absolute so just correct

55:47

it so just corrected this absolute now

55:51

just come

55:52

back now if i h on this one you can see

55:55

it will works fine when I H on this user

55:59

profile icon here we have the log out

56:01

option correct so this information will

56:05

be displayed whenever the user is

56:07

already logged in so now just come back

56:10

and here if I make it

56:14

null and save the changes so you can see

56:17

it is displaying the login button

56:21

correct now instead of adding this state

56:24

variable in this navigation bar we will

56:27

add it in the context file so that we

56:30

can store all our states and functions

56:33

in one place so let me just remove it

56:36

from here and remove this user State

56:42

also right and we will store it in one

56:46

store so in

56:48

this sidebar we have created one context

56:52

folder so in this context folder we will

56:55

create a new file file so write the file

56:57

name app

57:01

context do

57:03

jsx in this app context jsx we have to

57:07

create the context where we can store

57:10

the variables and functions and we can

57:12

use these variables and functions in any

57:16

component so here we have to add the

57:20

import a

57:21

statement so just add import

57:26

cly

57:27

Braes create context from react so we

57:31

have imported create context from react

57:35

correct Now using this create context we

57:38

will create a context variable so just

57:40

add

57:42

export const app

57:47

context equal to create

57:52

context now for this cont context file

57:56

we will create a context provider

57:58

function so just add

58:01

const app context

58:06

provider equal

58:08

to one Aro

58:11

function and here we will get the

58:16

props now in this one we can declare any

58:19

state variables or functions and we can

58:22

access it in any component so here let's

58:25

declare this

58:27

is user state so con user set user user

58:32

State null so we have declared it here

58:35

now here we will create one variable so

58:39

just add const

58:42

value equal to it will be one object so

58:47

in this one we can pass all

58:49

our variables and functions so we will

58:52

pass

58:54

this user

58:56

and set

58:59

user correct next we have to return so

59:02

just add return statement and in this

59:06

one just add app

59:11

context it will

59:13

be opening Tag app

59:19

context and here we will add app

59:21

context.

59:24

provider so you can see we have added

59:27

app context. provider and closing Tag

59:29

app context. provider here in this one

59:33

we will add value and provide this value

59:36

object correct and within this tag just

59:40

add curly

59:43

veres props do

59:47

children correct now what we have to do

59:50

we have to export this app context

59:53

provider so just copy this one and here

59:55

just add

59:57

export

60:00

default app context provider that's it

60:04

so now we have created the context and

60:07

from this context we can access the

60:10

variables and functions in any

60:12

component correct we have already

60:15

explained

60:16

this we have already explained this

60:19

context hook in a dedicated video where

60:22

I have explained all the react hooks I

60:24

will provide that video link in the

60:25

description

60:27

now after adding this we will come back

60:29

to

60:29

the main. jsx file so just

60:34

open main. jsx and here we have to add

60:38

the app context provider so first we

60:41

have to import that so here just add

60:45

import app context Provider from Context

60:49

folder app context. jsx file so we have

60:52

imported It app context provider and

60:54

after this browser router we will add

60:56

this tag just add app context provider

61:00

close this tag and we will move this

61:02

closing tag

61:04

here after this app component so you can

61:08

see what we have in this file first we

61:11

have the browser router and in this

61:13

browser router we have the app context

61:14

provider and in this app context

61:16

provider we have the app component now

61:19

in this app component we have the

61:20

support of this app context provider

61:24

right so we can access the context file

61:27

in this

61:28

app correct now let me remove this a

61:33

strict mode from here because we have

61:34

already removed

61:36

it after that we will come back to the

61:38

na. jsx file in this na. jsx file we

61:42

need the user so we will get the user

61:44

from Context so just add

61:48

const cly says

61:52

user equal

61:54

to use

61:57

context let's select this use context

62:00

from this suggestion so use context has

62:02

been

62:03

imported and in this use context we have

62:06

to provide the context that we have

62:09

created so we have

62:10

created app context select this from the

62:14

suggestion so this app context has been

62:17

imported now we have the user in this

62:20

file also and if you want to update the

62:24

user so you can go to this app context

62:27

and instead of this null we can make it

62:29

anything so if I come back to the web

62:32

page here we are getting some error so

62:35

let's inspect

62:37

it and go to console you can see we have

62:40

the error the a error occurred in app

62:43

context

62:45

provider user state is not defined so

62:49

let's come back and you can see here we

62:52

have

62:53

added user state but we have not

62:56

imported it right so just

63:00

add user State select it from here so

63:04

the user state has been imported from

63:06

react that's it save the changes again

63:07

come back to the web page and now you

63:09

can see here we have the navigation bar

63:11

with pricing link and login button

63:14

because the user is logged out now if I

63:17

come back and instead of this null we

63:19

will make it

63:21

true save the changes and come back to

63:23

the web page and you can see now we have

63:25

this credit left button then users name

63:28

and profile icon with log out link

63:32

correct so just come back and again make

63:34

it

63:36

null later we will connect the back end

63:40

so that we will get the status of this

63:42

user from our back end here in this navb

63:45

bar. jsx file you can see we have added

63:48

this button that is for the credit so

63:51

whenever we will click on this button it

63:53

should open the Buy credit page so here

63:56

also we can use the on

63:59

click and here just add the Aro

64:02

function and in this one use this

64:06

navigate and in this one just provide

64:08

the path forward

64:10

slby the same thing that we have added

64:14

here you can see we have added in this P

64:16

tag and here also we have added this

64:19

same thing correct save the changes and

64:22

you can see our navigation bar is

64:23

working now we have complete completed

64:26

the navigation bar and after completing

64:28

the navigation bar let's come back to

64:30

the figma design and in this one you can

64:32

see below this navigation bar we have

64:34

this header

64:36

section and in this header you can see

64:39

we have this small text with icon then

64:42

this welcome text a small description

64:44

one button and some

64:47

images correct so we have to create this

64:50

header section and this header section

64:52

will be displayed on

64:54

homepage so let's come back to the vs

64:56

code

64:57

editor

64:58

and let's open sideward and in this

65:02

sideward here we have the components

65:04

folder so in this components folder

65:07

right click and select new file and

65:09

write the file name header.

65:14

jsx here we will use

65:16

RFC right

65:23

header correct and after that we will

65:25

will

65:26

open home. jsx file and in this home.

65:30

jsx file we have this div and in this

65:32

div just add opening

65:34

tag header select this one from the

65:38

suggestion so the header component has

65:40

been imported close this tag save the

65:43

changes come back to the web

65:45

page here you can see we have the text

65:48

called header that is coming from this

65:52

component this one right so let me

65:55

remove this header and in this one we

65:57

have to add the text with one icon so in

66:02

this header let's

66:04

add one

66:07

div and in this one let's add one text

66:10

in P

66:12

tag let's move it in next

66:16

line and in this P we will add the text

66:20

so this is the text and after this text

66:23

we will add one star icon so just add

66:26

the IMG tag and here let's add

66:29

the curly bres assets dot start

66:36

icon and uh you can see the assets has

66:39

been imported correct save the changes

66:42

come back to the web page you can see

66:44

here we have the text and icon correct

66:47

now just come back and here we have the

66:50

first div so in this one we will add the

66:52

class name so in this one let's add the

66:55

Flix layout so just add Flex here we

66:57

will add flex and flex column so that it

67:00

will be displayed vertically then we

67:01

will add justify Center and items

67:05

center after that we have to add the

67:09

text

67:10

Center then margin from y AIS

67:15

20 correct now we have this div and in

67:20

this D we will add the class name

67:21

property and in this one we will add

67:24

text color so just add text a stone 500

67:29

this is the text color then we'll add

67:31

the inline

67:33

Flex after that text

67:36

Center then we will add the gap of two

67:40

then we'll change the background so just

67:42

add BG

67:44

white next we'll add the padding from x

67:47

axis that is six and padding from Y axis

67:50

one after that we'll add rounded full

67:54

next we'll add the border and then we'll

67:58

add the Border colors so just add

68:02

border neutral

68:04

500 save the changes come back to the

68:07

web page now you can see this text and

68:10

icons are looking good with this button

68:13

style after that we have to add a large

68:17

text so just come back and after closing

68:20

of this du we will add one title in

68:26

H1 so in this H1 tag we will add the

68:31

text turn text to image in

68:38

seconds so this is the

68:42

text you can see this text here correct

68:46

now for this title we will add the class

68:50

name and we have to increase the size of

68:53

this text so just add text 4

68:58

XEL after that we will add maximum width

69:02

that is 300

69:05

pixel then we'll add the different text

69:08

size for a smaller

69:12

screen then we'll add a small and here

69:15

we will

69:16

add maximum

69:18

width and we will add one custom width

69:21

here so let me

69:23

add 59 0

69:27

pixel correct and now we will add

69:31

the margin from the left side and right

69:34

side so just add MX

69:37

Auto then we will add the margin from

69:39

top 10 and text

69:44

Center save the changes come back to the

69:47

web page you can see this text in the

69:50

center and in large size next we have to

69:54

change the

69:56

color of some portion of this text

69:59

correct so just come back and here you

70:02

can see we have this text text turn two

70:06

and after that we have this image so let

70:08

me wrap this image in a span tag so here

70:12

just add opening Arrow

70:15

span close

70:17

it and close this a span tag after this

70:21

image

70:24

text now for this asan tag we can add

70:27

the class name property and here just

70:29

add the text color so just add text blue

70:33

600 that's it save the changes come back

70:36

to the web page and now you can see this

70:38

image text is in blue

70:41

colored now after this title text we

70:46

will add a small description in P tag so

70:49

let me just come back and here just

70:52

after this H1 let's add a space and and

70:55

we will add the P tag in this P tag we

70:58

will add one description text so this is

71:01

the description and here we will add the

71:04

class name also so in this one let me

71:06

add the classes we will add the text

71:09

Center then we will add the maximum

71:10

width and margin X Auto and margin top

71:15

five that's it save the changes and now

71:18

you can see here we have this

71:20

text

71:22

correct after this text let's come back

71:25

and here we have to display one button

71:29

so after this P tag we will add the

71:33

button

71:34

tag and in this button we will add the

71:38

button text that is generate images and

71:42

then we'll add the icon also so just add

71:44

the IMG tag let me move it in the next

71:47

line so it will look good so in this

71:51

image tag we have to add

71:53

the image so just add SRC

71:57

assets dot star

72:02

group come back to the web page here you

72:04

can see we have this generate image

72:09

text then we have these Stars correct so

72:13

we have to add the CSS properties for

72:15

this

72:16

button so let me just come back and uh

72:19

in this button let's add the class name

72:23

and here we will provide the

72:26

text size

72:27

for small device so just add text LG

72:33

then we'll add the text size then we'll

72:36

add the text

72:39

white after that we will add the

72:42

background so the background will be

72:44

black BG

72:47

black next we have to add the width

72:51

Auto and margin

72:54

top8 then we'll add the margin from x

72:56

axis that is 12 and padding from y that

73:00

is 2.5 then we'll add the flex so that

73:04

the icon and button text will be aligned

73:06

side by side then item

73:10

Center then we will add the gap

73:13

of

73:15

two then rounded

73:20

full that's it save the changes and come

73:23

back to the web page

73:27

you can see it looks like a button but

73:29

now we have to decrease the size of the

73:33

star icon so just come back and here we

73:36

have the image tag and in this one we'll

73:38

add the class name and just provide the

73:41

height height six save the

73:45

changes now you can see this generate

73:47

image button is looking good correct

73:51

after that we have to add some more

73:52

content so let me just come back to the

73:54

Fig design and in this one you can see

73:57

after this button we have these images

74:00

so we have total six

74:03

image correct and then we have one a

74:05

small text generated images from imagify

74:10

so we have to display six images and

74:12

this a small text in this header section

74:15

so let me just come back to the vs

74:17

code and after this

74:21

button let's add space and here we will

74:24

add one

74:26

div now in this div we have to display

74:30

multiple images so we will use one add a

74:33

so just add curly

74:36

presses add

74:38

a six so the added length will be six

74:42

then we'll add the

74:45

fill and it will be empty string then

74:50

we'll use the map

74:52

method now in this map

74:56

we can add the Aro

75:00

function correct and in this parameter

75:04

we will take

75:06

item and

75:10

index correct now in this one we have to

75:13

display the image using the IMG tag so

75:17

just add the IMG

75:19

tag and uh in this image tag we have to

75:23

display the images so just add the curly

75:26

Braes and here we can

75:29

use assets dot sample image 1 like this

75:36

and uh for this one we have to add the

75:40

key property so just add

75:43

key is equal to

75:45

index and then we will add the

75:49

width

75:51

and this width will be after this index

75:56

and in this width just add

75:59

70 now if I come back to the web page

76:02

you can

76:04

see we don't have the image here so

76:08

let's come back instead of this curly

76:12

bres we have to use the small

76:16

bracket here also we will add a small

76:18

bracket like this correct now just come

76:22

back and here you can see we have have

76:25

six images that is displayed vertically

76:28

correct now just come back and here in

76:31

this image tag let's add the class name

76:34

so here we will

76:36

add rounded then hover so whenever we

76:41

will hover on this one it should

76:43

increase the size so just add a scale

76:46

105 then we will add the

76:51

transition all then we will add the

76:56

duration 300 then cursor

77:01

pointer after that we will add

77:06

the max

77:09

SM width

77:12

10 and now here we have this div also so

77:15

in this div we will add the class name

77:17

property so that we can align all the

77:20

images side by side so in this div we

77:23

will add Flex

77:26

then Flex wrap then justify Center then

77:30

we'll add the margin from top 16 and we

77:34

will add the Gap

77:35

three now just come back to the web page

77:38

and you can see these images are aligned

77:41

horizontally correct now here you can

77:45

see the same image in all positions

77:48

right so now we have two images so I

77:52

will display the images in alternate

77:54

position first it will display the

77:56

sample image 1 then it will display

77:58

sample image two then again sample image

78:01

1 and Sample image two like that for

78:03

that here we will use the Turner

78:05

operator so let me add it in new line so

78:07

that you can see

78:10

clearly here in this SRC we have assets

78:14

do sample image 1 correct so instead of

78:17

adding this we will use the Turner

78:19

operator we will

78:21

add index percent

78:25

2 if it is zero then what will happen it

78:30

will display sample

78:34

image

78:35

two correct and here we will add colon

78:39

then provide assets. sample image 1 so

78:42

what is happening here if it is

78:44

divisible by two then it will display

78:47

sample image 2 and if it is not

78:49

divisible by two then it will display

78:51

the sample image one that's it save the

78:53

changes and come back to the the web

78:55

page

78:56

again you can see here we have the first

78:59

image second image then again first

79:01

image second image again first image and

79:03

second

79:04

image it looks good after this image we

79:07

have to display one small text so just

79:10

come back and here we have this array

79:14

and this div that contains all the

79:17

images so after this div let's add one P

79:20

tag and in this P tag we will add the

79:24

text

79:25

generated images from

79:28

imagify and in this one also we will add

79:30

the classes so just add the class name

79:32

property and we'll add margin from

79:35

Top text neutral

79:40

600 that's it save the changes and come

79:42

back to the web

79:43

page now you can see very small text

79:46

below this image so now we have

79:49

completed the header section of our

79:52

application

79:54

after completing this header section

79:57

let's come back to the figma

79:59

design and here you can see after this

80:03

header we have this content where you

80:06

can see the text called how it works and

80:09

here we have some steps describe your

80:11

vision watch the magic download and

80:14

share so these are the steps to generate

80:17

the image so next we have to create this

80:20

steps components correct so let's come

80:24

back to the vs code editor and in this

80:28

left side bar we will go to complaints

80:31

right click here and select new file and

80:33

here we will add the file name steps.

80:39

jsx in this one we will add

80:42

RFC and it will create this functional

80:45

component correct now in this one we

80:49

have to add the content from the assets

80:51

file you can see assets assets do JS and

80:56

in this one you can see we have

80:59

added a steps data so this is one aray

81:03

and in this aray we

81:04

have three

81:07

object

81:09

correct so we have to display the data

81:11

from this steps data

81:14

array now just come back and in this

81:18

steps. jsx file first in this div we

81:23

have to add the

81:25

title so here let's add the title in H1

81:28

tag and in this title we will add the

81:31

text called how it

81:33

works now in this H1 we will add the

81:36

class name properties so in this one we

81:38

have to provide some classes like text 3

81:42

XL then we will add

81:45

the text size for small screen device

81:50

then we'll add the font weight that is

81:53

semi bold and we will add the margin

81:55

from the

81:57

bottom

82:00

mb2 after this title there will be one

82:03

small text in P tag so here let me add

82:06

the

82:08

text transform words into a stunning

82:12

images and here let's add the class name

82:16

and here just add the text

82:20

large after that we'll add the text

82:22

color so just add text

82:25

gray

82:27

600 then we will add the margin from the

82:30

bottom

82:32

mb8 like this so we have added the title

82:36

and description in a small P tag after

82:41

that we have to add one div so after

82:44

this P tag we will add one div and in

82:47

this div we have to display the steps

82:50

data

82:51

so here let's add the curly bres

82:55

just add the steps

82:57

data select this from the snapit so you

83:00

can see the steps data has been imported

83:02

from the assets folder assets file so

83:06

this is one ad so on this ad we can use

83:08

the map method so let's add do

83:13

map in this one we have to add the Aro

83:16

function so just

83:18

add one Arrow function and here we will

83:22

use this small bracket

83:25

correct now in this parameter we will

83:27

add the

83:30

item then we will add

83:34

index now in this

83:38

one let's add one div so it will return

83:42

a

83:43

div and uh in this div we have to add

83:47

one image so just add the

83:50

image in this image let's add curly

83:53

Braes and H here we will use this

83:56

item because each object contains one

84:00

property called icon so just add item do

84:05

icon after that here let's add

84:11

div and in this D we will add the a

84:14

steps title and a steps description so

84:17

we will add the title in h2 tag so just

84:20

add the curly

84:22

Braes and here we will add the

84:25

item

84:27

dot

84:29

title after that we will add the P tag

84:32

and in this one we will add same

84:35

thing and instead of title we will

84:38

add

84:42

description like this and here we have

84:45

this div so in this div just add the key

84:48

property and in this key we will add

84:52

index like this see save the changes and

84:56

next we have to mount this steps

84:58

component

84:59

in homepage so just

85:03

open home and after this header let's

85:08

add a steps so a steps component has

85:12

been imported close this

85:16

tag save the

85:18

changes now just come back to the web

85:21

page scroll down and here you can see we

85:25

have the title how it works then a small

85:28

description then we have the icons for

85:30

different steps then a steps title

85:34

description correct so now we have to

85:37

provide the CSS for this element so just

85:41

come

85:43

back and uh first we have this div so in

85:48

this div just add the class name

85:51

property and here we have to add

85:55

Flex then we will add Flex column so it

85:59

will be displayed

86:01

vertically after that we'll add items

86:05

Center then justify

86:09

Center then we will add the margin y 32

86:14

correct after that here we have the

86:16

title in H1 so in this title we have

86:19

already provided the classes and in this

86:22

description also then we have the div

86:25

that contains a steps so in this div

86:28

let's add the class name property and

86:30

here we will add a space

86:33

y four then we will add the width

86:38

full then we will add the maximum

86:42

width and after that we will add the

86:46

text size so the text will be small

86:49

correct next we have this

86:52

D for IND individual item right so for

86:56

individual item let me add the class

87:00

name in this one we will add flex and

87:03

item

87:04

Center then we will add the gap of

87:09

for after that we will add the padding

87:13

five then padding x 8 then we will add

87:17

the background so BG

87:22

white/ 20 so the opacity will be

87:27

20% it means the background color

87:30

opacity now we'll add the

87:33

shadow

87:35

medium then we will add the

87:38

Border then cursor

87:42

pointer and after that we'll add the

87:45

hover effect so just add hover and just

87:49

add a

87:51

scale and in this scale we will add the

87:54

custom

87:55

value in this square bracket so we will

87:58

add

87:59

1.02 correct then we'll add the

88:04

transition all and duration

88:10

300 after that in

88:13

this image tag we have to provide the

88:16

width so just add the

88:17

width

88:19

40 then we have

88:22

this a small typ title and a small

88:25

description so in this h2 tag just add

88:28

the class name and here we have to add

88:30

the text size and font weight so I will

88:34

provide text Excel and font medium now

88:38

in this P tag we will add the class name

88:41

and here we will just add the text color

88:43

so the text color is gray 500 save the

88:47

changes and come back to the web

88:49

page now you can see these steps are

88:53

looking good

88:55

and here in these individual steps we

88:58

have to add the round corners right so

89:02

just come back and uh here in this

89:07

D after this duration 300 just

89:12

add

89:14

rounded

89:16

large save the changes and come back to

89:18

the web page now you can see these steps

89:22

are looking beautiful

89:25

correct so after completing this steps

89:29

section let me just come back to the

89:31

figma design and here you can see we

89:33

have the next section that is the

89:36

description section where we can add the

89:40

title small description and then we have

89:42

the content in two columns left and

89:45

right side in the left side we will add

89:47

the image and in the right side we will

89:48

add the description so just come back

89:54

and uh in the left side

89:59

bar open this SRC folder then right

90:03

click on this components folder and here

90:05

we will create a new file and write the

90:07

file name description.

90:14

jsx here just add

90:18

rafc and uh in this

90:21

one we have to add the

90:24

title so in this D we will add the title

90:26

in H1 so in this title we will add the

90:29

text

90:32

called create AI images after that we

90:36

will add the text in P tag that is the

90:38

small description so here just add the

90:42

text like this so in this div we have

90:46

added the title and a small description

90:48

now let's add some CSS properties so in

90:51

this one we will add the class name and

90:53

here we will add Flex Flex column item

90:57

Center justify

90:59

Center like this after that we have to

91:02

add the margin from y AIS then we will

91:06

add the padding and we will add the

91:08

padding X for medium screen size so we

91:12

have added

91:14

myy P6 then PX

91:18

28 after that we have the title and

91:21

description so let's add the CSS

91:23

properties for this one so in this H1

91:26

just add the class name and let's

91:29

increase the text

91:32

size text 3 XEL then for a small device

91:38

we will

91:39

add text for

91:43

Xcel

91:45

then font semi bold then we will add

91:49

margin bottom

91:52

two after that in this description we

91:56

will add class

91:58

name and for this one we will add text

92:04

Gray

92:06

500 and uh in this one we will add the

92:09

margin from the bottom

92:13

8 like this now save the changes and

92:16

after that we have to mount this

92:18

description component on homepage so

92:21

let's open

92:24

home. jsx and after this steps let's

92:28

add description component so description

92:31

component has been

92:33

imported close this tag now just come

92:36

back to the web page and if I scroll

92:40

this web page here you can see we have

92:42

the title create AI images and this a

92:45

small description after that we have to

92:48

add the content in two columns left and

92:51

right side so let's come back

92:54

open description. jsx file and after

92:58

this P tag let's add a

93:00

space here we will add one div and in

93:04

this div in the left side we will add

93:06

the image using the IMG tag and here

93:09

let's add the image from

93:14

assets

93:16

dot sample image

93:19

one after that we will add the class

93:22

name also so here for this image let's

93:25

provide the class name width

93:29

80 for Excel screen size we will add

93:35

width

93:37

96 after that we will add

93:42

rounded it will be

93:44

large then we will

93:47

add one

93:49

div so after this image we have added

93:52

one div that will will be displayed in

93:54

the right side now in this div we have

93:57

to add one text in the S2 tag so just

94:02

add S2 and write this text correct and

94:07

after this text we will add description

94:09

in P tag so let's add the P tag and in

94:12

this P we will add the

94:15

text correct and after that we'll add

94:19

one more text in P tag so just add

94:22

another P tag and and paste this

94:27

text correct so now we have the image

94:30

and text now just come back to the web

94:33

page here you can see we have this image

94:35

and we have these

94:37

text below this image so we have to

94:40

align it side by side so let me just

94:42

come

94:43

back and for this div we will add the

94:47

class name so in this div just add the

94:50

class name property and here let's

94:52

provide flex and Flex

94:55

column and GAP

94:58

five now we will add the medium a screen

95:02

size so for medium a screen size we will

95:04

increase the Gap so the Gap will

95:08

be

95:10

14 after that we will add medium screen

95:14

and for this medium screen size we will

95:16

add Flex row so that it will be

95:19

displayed side by side and for a small

95:23

and mile phone screen it will be

95:24

displayed

95:25

vertically correct after that we have to

95:29

add item

95:34

Center that's it save the changes and

95:37

come back to the web page now you can

95:39

see this image in the left side and this

95:41

text in the right side correct now just

95:44

come back and here we have this div

95:47

where we have added the H2 and P so for

95:51

this H2 let me add the class name and in

95:54

this one we have to increase the text

95:56

size so the text size will be 3 XL then

96:01

we will add the font medium so that the

96:04

font weight will be increased then we

96:07

will add the maximum width and after

96:10

that we will add margin from bottom

96:15

four after that here we have the P tag

96:17

also so in this P tag we will add the

96:20

class name and in this one we will add

96:22

the

96:24

text color and margin bottom so the text

96:26

color is gray 600 let me add the same

96:30

text color in the next

96:33

text that is next p tag so just add the

96:36

class name and provide this color that's

96:39

it now save the changes and come back to

96:41

the web page here you can see this text

96:45

are looking

96:46

good and if I come back to the figma

96:49

design you can see it looks

96:52

same correct

96:55

so now we have completed our description

96:57

section also and after this description

97:00

we have to display this testimonial

97:04

section to create this testimonial

97:06

section let me just come back to the vs

97:09

code and close this

97:13

file and let's open sidebar and in this

97:18

competence folder we will create a new

97:20

file with the name testim mon.

97:30

jsx here we will use rafc

97:36

snippit now we have to mount this

97:38

testimonials component in the homepage

97:41

so just open home. jsx and after this

97:45

description just add opening

97:48

arrow and

97:51

write testimoni

97:53

select this from the snapit so the

97:56

testimonial component has been imported

97:59

close this tag correct so we have

98:01

mounted the testimonials in this

98:04

homepage after that we will add the

98:06

elements in this testimonial component

98:08

so in this

98:10

one here we have this div and within

98:13

this div we have to add the title and

98:15

one text so let me just copy the title

98:18

from the previous section so let me just

98:20

open

98:23

description and from

98:25

here just copy the class name from the

98:28

first

98:30

D and paste it in this

98:34

one so here we have added Flex Flex

98:37

column item Center justify Center and in

98:40

this m y we will add

98:43

20 then we will add the padding

98:47

y

98:50

12 and remove this PX

98:56

correct after that we have added

98:59

this title and description in H1 and P

99:03

tag so just copy this one from the

99:05

description part and paste it

99:07

here

99:09

so we have added the H1 and P and in

99:13

this one we have to update the text so

99:15

first we'll update this title it is

99:19

customer testimonials and here we will

99:21

add the small text in P tag so we have

99:25

updated the text in P tag so here you

99:28

can see we have added text 3 XL then

99:32

text 4 XEL then font semi bold and

99:35

margin bottom two and in this one we

99:38

have added text Gray 500 and margin

99:42

bottom and we will make it 12 so margin

99:46

bottom is

99:48

12 after adding this if I come back to

99:50

the web page scroll down and and here

99:53

you can see customer testimonials and

99:55

this a small text after that we have to

99:58

display the testimonials in three column

100:01

and we have already added the

100:03

testimonial data in the assets so if I

100:06

open assets folder assets file so in

100:10

this one you can see we have one array

100:12

called testimonials data and here we

100:15

have added the testimonials in each

100:19

object so here you can see we have added

100:21

the testimonials array and in this array

100:24

we have three object that represents

100:27

individual testimonial data correct so

100:30

we have to use this data to display the

100:32

testimonial on our homepage so in this

100:35

testimonials. jsx file after this P tag

100:39

let's add one

100:42

div and for this div let me add the

100:46

classes also so just add the class name

100:47

property and in this one we will provide

100:49

Flex Flex wrap and we will add the gap

100:53

of six after that in this div we will

100:57

use curly bres and here just

101:01

use testimonials data from assets it has

101:05

been imported in this one we can use the

101:08

map method because it is an array and in

101:12

this map method we will add the Aro

101:15

function so just

101:18

add one Aro function and here we will

101:20

use the small bracket now in this

101:23

parameter we will add testimonial and

101:32

index so this is the individual

101:36

testimonial data and this is the index

101:39

number now in this we will add one

101:44

div and it will return this div and in

101:48

this div we have to add the key property

101:50

so in this key we will add the index

101:53

like this now within this div we have to

101:57

display the users image then users's

102:02

name then role and we will display the a

102:05

star rating then we will display the

102:08

testimonial text so we will display that

102:12

in one div so just

102:14

add div and uh in this div just add the

102:19

image and in this SRC just add

102:24

testimonial that is the single

102:26

testimonial data dot

102:29

image so we will get the image and for

102:33

this image just add the class name and

102:36

here just add rounded full so that it

102:40

will be Circle and we will add the width

102:44

14 that's it if I save the changes come

102:47

back to the web page here you can see we

102:49

have three users image because we have

102:51

total three testimonial data

102:53

right so right now we have just added

102:55

the image using this

102:59

map right and after this image we have

103:02

to add the name so we will display the

103:05

name in

103:07

H2 so in this H2 just add curly

103:11

presses and we will

103:14

add testimonial dot name so it will be

103:18

the user's name correct after that

103:22

duplicate this line

103:23

and we will make it

103:25

P closing P tag also and here we will

103:28

add testimonial.

103:32

roll correct and after that we have to

103:36

add one div so after this P tag let's

103:40

add one div and in this div we have to

103:43

add the star rating so let's add one

103:47

class name

103:49

here and in this class just add Flex

103:55

margin bottom

103:56

for now we will add one aray so just add

104:00

curly

104:02

Braes are a and uh in this one we have

104:06

to add this

104:08

testimonial

104:10

dot

104:13

Stars Then dot

104:17

fill and uh here we will add dot map

104:24

here also we will add the Aro

104:26

function with a small

104:31

bracket and uh in this map parameter we

104:36

will add item and uh

104:40

index now based on this index we will

104:43

display the start icons so in this a

104:46

small bracket we will add the IMG

104:50

tag and uh here just just add key

104:55

property in this key property we will

104:57

add

104:58

index and after that we have the SRC so

105:01

in this SRC just add curlys and we will

105:03

provide

105:06

assets dot rating

105:10

star like

105:13

this and after that we have to display

105:17

the testimonial text so after closing of

105:20

this div here we will add p tag and in

105:23

this P tag we have to display the

105:26

testimonial text so just copy this one

105:28

paste it here and instead of name we

105:30

will

105:31

add

105:33

text

105:34

correct now let's come back to the web

105:36

page and here you can see we have the

105:39

users image name

105:42

role a start rating and

105:46

this testimonial text so in all

105:49

testimonial you can see five star

105:51

correct so let me just come

105:54

back and uh

105:57

open assets and here you can see we have

106:00

the STS five five and five in each so

106:04

let me add four in this one in the

106:07

second one we will add four save the

106:09

changes and come back to the web page

106:12

now in this one you can see we have four

106:14

rest starts in this one we have five and

106:16

five correct next we will add the CSS

106:19

properties for this component so just

106:21

come back

106:23

and in this testimonials. jsx we have

106:26

one div where we have added all the

106:29

testimonials right then we have this div

106:32

where we have added the key property

106:35

correct so in this one we will add the

106:38

class

106:40

name let me make it in new line so that

106:43

we can see the text clearly so here we

106:46

have to add the background color so just

106:48

add BG white/

106:56

20 after that we'll add the padding 12

107:01

then we will

107:03

add

107:05

rounded it is large then we'll add

107:10

shadow shadow it will be

107:15

medium after that we will add border and

107:18

width so just add the border and the

107:21

width will be

107:24

80 then we'll add the margin Auto after

107:28

that we'll add cursor

107:31

pointer next we will add

107:33

hover and in this hover we will increase

107:36

the size so just add a

107:40

scale

107:41

1.02 then we'll add the

107:45

transition

107:47

all correct then we have this div

107:51

correct so in in this div we will add

107:53

the class name property and in this one

107:56

we will provide the flex Flex column and

107:58

item

108:01

Center like this next we have this image

108:05

and in this image we have already added

108:07

the class name then we have the title in

108:10

H2 so in this H2 we will add the class

108:13

name property and here we have to add

108:15

the text size font weight and margin

108:19

from the top so we will provide text

108:21

Excel font semi gold and margin top

108:23

three after that we have this B tag

108:27

where we have added the role so here

108:29

just add the class name property and in

108:32

this one we have to change the text

108:34

color and we will add the margin from

108:35

the bottom so we will add text Gray 500

108:38

and margin bottom for correct then we

108:41

have this div where we have added the

108:44

class name then we have this image for

108:47

start

108:48

rating then at the end we have this

108:51

testimonial text so in this one also we

108:53

will add the class name so just add

108:56

class name and here we have to add the

108:58

text Center then we will add the text

109:00

size a small then we will add the text

109:03

color so the text color will be gray 600

109:07

like this now save the changes and come

109:11

back to the web

109:14

page here you can see these testimonials

109:18

are looking good and here we have some

109:21

hover effect

109:26

so now we have completed the testimonial

109:29

section

109:30

also correct after that we will come

109:33

back to the figma design and here you

109:35

can see after this testimonial we have

109:37

to display this title and this

109:41

button so for this one we have to create

109:45

one component so let me add a new

109:50

component in this left side bar we have

109:52

have the components folder right click

109:54

and select new file and here we will add

109:58

the file name generate button.

110:06

jsx so we have added generate bn. jsx

110:10

because here we will add one button now

110:14

we will add RFC

110:17

snippet and after that we have to mount

110:19

this component in homepage so just open

110:23

home. jsx and after this testimonials we

110:27

will

110:29

add generate BTN so generate BTN

110:32

component has been

110:35

imported correct after that let's open

110:39

generate BTN

110:42

component and in this

110:45

one here we have to add

110:48

one

110:50

title So within this D let's add one

110:54

title in H1 and in this title we will

110:56

add the

110:58

text see the magic try now and after

111:02

this title we will add one button so

111:05

just add the button tag and in this

111:07

button we will add generate image text

111:10

and after that we will add one icon also

111:14

so just add the IMG tag and here in this

111:17

SRC we will add curly

111:19

Braes then assets

111:24

dot star

111:27

group correct and in this one we have to

111:30

add the height so let's add the class

111:33

name property and H six so the height is

111:37

six for this star group image after that

111:41

here we have this button and H1 tag so

111:43

for this H1 let's add the classes so we

111:46

will add the class name property and in

111:48

this one let me add these classes so for

111:51

this title we have provided text 2 XL

111:54

then text 3 XL then text 4 XL for

111:57

different screen size then margin top

111:59

font semi bold text neutral 800 padding

112:03

Y6 and padding y 16 correct after that

112:07

here we have this button so in this

112:09

button also we will add the classes so

112:12

here let's add the class name

112:16

property and in this class name we will

112:20

provide inline Flex items and Center Gap

112:23

two padding X12 padding Y3 round it full

112:27

then we will add the background color

112:29

black text color white then margin Auto

112:32

then we will add the hover effect so it

112:34

will increase the size whenever we will

112:36

hover on the button transition all

112:39

duration 500 correct after that here we

112:43

have

112:44

this div right so in this div also we

112:48

will add the class name and in this one

112:50

we will add the padding from the bottom

112:52

so just add padding bottom 16 and text

112:59

Center that's it after adding this let's

113:03

come back to the web

113:05

page here you can see we have this see

113:09

the magic text and this generate images

113:13

button correct now let's come back to

113:15

the figma design and here you can see

113:17

after this section we have the

113:20

footer correct

113:23

and this footer will be displayed in all

113:27

pages so we have to add this footer

113:31

component outside of the router so let

113:34

me just come back to vs

113:37

code and first we will create the footer

113:40

component so in the left side bar go to

113:43

components folder right click and select

113:45

new file and write the file name footer.

113:47

jsx

113:54

here we will use our

113:56

AFC and in this footer

113:58

component we have to add the class name

114:02

in this

114:04

div so in this div we will add the class

114:07

name and we will use the flex so that

114:10

the content will be aligned side by side

114:12

so just add Flex then item Center and

114:18

justify

114:19

between correct then we will provide the

114:22

Gap so the Gap will be

114:25

four after that we will add the padding

114:28

from y AIS that is three then we will

114:31

add the margin from top that is 20

114:34

correct now in this footer we will add

114:36

the logo in the left side so here just

114:39

add the IMG tag and in this one we have

114:43

to add the path or we will provide the

114:47

logo so just add

114:49

assets Dot

114:54

logo and for this image we have to

114:57

provide the width also so just add the

114:59

width and the width is

115:02

150 correct and after that we have to

115:06

add one text so after this image we will

115:10

add one P tag and in this P tag we will

115:13

add the copy text so this is the

115:17

text copyright greatest T Dev all right

115:21

reserved

115:23

now after this text we have to add some

115:26

links so we will use the div and in this

115:30

div we will add images so just add the

115:33

IMG tag and for this one we will add cly

115:39

bres assets

115:42

dot Facebook

115:45

icon and for this image we will provide

115:48

the width also so just add the width 35

115:53

correct now just duplicate it and

115:57

instead of Facebook icon we will add

116:00

Twitter icon now in the next one we will

116:03

add Instagram

116:06

icon correct now we have to align these

116:10

images side by side so here with this D

116:13

we will add the class name and we will

116:15

add flex and we will provide the Gap so

116:19

the Gap will be

116:26

2.5 then we have this P tag correct so

116:29

in this P also we will add the class

116:31

name and here let's add Flex one so it

116:37

will use the entire space available in

116:38

the row then we will add the Border

116:41

one then we will

116:44

add border color so just add

116:47

border gray

116:49

400 after that we will add adding from

116:52

left side so it is for then we will

116:56

add text a

116:59

small then we will add text color so

117:03

just add

117:04

text Gray

117:07

500 correct and for mobile device it

117:12

will be hidden so just add Max

117:16

SM it will be

117:19

hidden after adding this we have to

117:21

mount this footer component in the

117:24

app.jsx file so let's open app.jsx in

117:28

this one you can see here we have the

117:30

routes so after this routes let's add

117:35

opening Ado we will use footer and

117:38

select this from the snippet so this

117:40

footer component has been imported close

117:43

this

117:44

tag so here you can see we have added

117:48

this footer outside of this routes

117:50

that's why this footer will be displayed

117:52

on all the pages save the changes come

117:54

back to the web page scroll down and

117:57

here you can see at the bottom we have

117:59

this footer so in the left side we have

118:02

the image then copyright message and in

118:04

the right side we have these icons if I

118:07

go to figma design you can see it is

118:10

same as this

118:12

design here we have to add the vertical

118:14

line in the left side as you can see

118:16

here correct so let me just come back

118:18

and uh we have added it but it is not

118:23

visible if I go to footer. jsx you can

118:26

see we have added border it will be

118:29

border L it means border

118:31

left save the changes come

118:41

back and it will be border left let me

118:44

correct the spelling also it

118:46

is border L then border gray padding

118:51

left right save the changes and come

118:53

back to the web

118:54

page now you can see we have a vertical

118:56

line before this

118:58

text so now we have completed the

119:01

homepage of our

119:06

application after completing the

119:08

homepage next we will create the second

119:12

page so let me see this figma design and

119:16

you can see here we have the another

119:18

page that is the result page so that

119:21

whenever people will enter the prompt

119:24

then they can see the result image on

119:27

this page like this

119:30

correct so to create this result page

119:32

let me just come back to the VSS

119:36

code here we will come to left side word

119:39

and in this one we have result. jsx file

119:44

so let's open this file result. jsx and

119:48

in this one you can see we have this

119:50

text called result page and if I come

119:53

back to the web browser and in this path

119:56

if I type SL

119:59

result so it will display the result

120:01

page so in this page you can see the

120:03

navigation bar and footer it is already

120:06

there then we have this text called

120:09

result page so we will remove this text

120:11

and we will add these content like this

120:14

image this loading text this form where

120:18

user can enter the prompt and click on

120:20

this generate button correct so let's

120:23

come back and remove this

120:27

one and here in this div let's add one

120:33

another

120:35

div and within this div we have to add

120:39

one class name so let's add class

120:45

name and we will add the class name

120:47

relative

120:52

and within this we will add one

120:55

image so add the IMG tag and here we

120:59

will provide

121:01

the image so just add cly bres

121:06

assets

121:08

Dot and uh here we will

121:11

use sample

121:14

image sample image 1 so we have added

121:17

this image and in this image we will add

121:21

the classes so just add the class name

121:24

and for this one let's provide the

121:27

maximum

121:30

width it is a

121:33

small after that we will add the Border

121:36

radius so just

121:39

add

121:42

rounded correct after this image we will

121:46

add one asan tag and using this asan we

121:49

will display one horizontal line below

121:51

the image so let me add the self closing

121:56

tag like this now in this one we will

121:58

add the class name and here let's

122:01

provide absolute so the position will be

122:04

absolute then we will add bottom

122:08

0 left zero then we will add the height

122:12

one after that we will add the

122:16

background background blue

122:19

500 after that we will add the width

122:23

full and then we will add

122:27

the

122:30

transition

122:32

all then we will add the

122:34

duration and in the duration we will

122:38

add 10

122:40

seconds correct if I save the changes

122:43

and come back to the web page here you

122:46

can see

122:47

this image and this horizontal line

122:51

correct

122:52

now let me just come

122:54

back and

122:56

uh after this div we will add one text

123:01

so just add the P tag and in this text

123:04

we will add

123:05

the message

123:07

loading after adding this text just come

123:11

back and here you can see this text

123:14

loading below this blue horizontal

123:17

line after that we have to add one form

123:21

with here we will add the input field

123:23

and button so after this P tag and after

123:29

this closing div tag here we will add

123:32

another

123:33

div and we cannot return to div like

123:37

this so before this div here let me add

123:42

one form tag we will add this form

123:46

tag and close this form

123:50

here at the end

123:52

so we are just returning one form tag

123:54

and in this one we have the first

123:57

div and now we will create the second

123:59

div now in this second div let's add one

124:04

input field so just add input the typee

124:08

will be

124:09

text and after that we will add the

124:13

placeholder and in this placeholder let

124:16

me add describe what you want to

124:20

generate so this is the placeholder text

124:24

and after that we'll add the class name

124:27

property so let's add the class name and

124:29

here we will add the classes so let's

124:33

add Flex one background transparent

124:37

outline none margin left 8 and Max SM

124:44

width 20 correct and after that we have

124:47

to add one button so after this input

124:51

field we will will add one button

124:53

tag and in this button we will add the

124:56

text called generate correct and the

125:00

button type will be

125:04

submit and now in this button we will

125:07

add the class name so just add class

125:11

name

125:12

property and here we have to add the

125:16

background then we will add the

125:20

padding after that we will add the

125:22

padding for small screen device then

125:25

padding y then rounded full so we have

125:29

added this CSS properties in the button

125:32

after that you can see here we have this

125:34

input field where we can type anything

125:37

and here we have this button

125:40

correct next we will add one more thing

125:43

in this div we will add the class

125:46

name so in this div we will add Flex so

125:51

that it will be aligned side by side

125:54

after that we will add the width that is

125:56

full then we will add the maximum

125:59

width

126:01

Excel after that we have to add the

126:04

background and we will make the text

126:06

white so we have added the background

126:09

and text

126:11

white correct and now then we will add

126:15

the padding and margin top and Border

126:17

radius so we will

126:20

add text a small padding 0.5 margin top

126:25

and rounded full after writing this you

126:28

can see here we have this input field

126:32

with this generate

126:34

button now let me just come back and

126:37

here you can see we have added the form

126:40

tag so in this form also we will add the

126:43

class name so in this form tag we will

126:45

add the class name and here we have to

126:48

provide flex and flex column

126:51

then we will add the minimum

126:54

height and after that we will add

126:56

justify Center and item

127:00

Center save the changes come back to the

127:03

web page now you can see here we have

127:05

this image then this blue horizontal

127:07

line then loading and here we have the

127:09

input field and generate button correct

127:13

next we have to change the color of this

127:15

place holder text for that we have to

127:18

use a custom class

127:20

name in this input field we will add our

127:23

own class name so let's add placeholder

127:29

color just copy this class name and we

127:32

will

127:33

open index. CSS file here we will add

127:36

this class name and for this class name

127:38

we will provide the CSS properties so in

127:42

this one we will add the color and font

127:46

weight so we have added this color and

127:48

this font weight after that let's come

127:50

back to the web page page now you can

127:52

see the color for this placeholder text

127:57

and in this input field we can write

128:05

anything like

128:07

this after this input field and button

128:10

we will add two other buttons that is

128:13

generate another and the second button

128:15

name is download so just come

128:19

back and we will open

128:22

result. jsx file and here we have

128:27

this closing form tag so before this one

128:31

we will add a space and here let's add

128:33

one

128:35

div and within this div let's add the P

128:38

tag and in this one we will add the text

128:41

called generate

128:43

another duplicate it and in this one we

128:46

will add the text

128:49

called download

128:52

so instead of this P we will use the a

128:55

tag so let me just remove it and here we

128:57

will add one a tag and the link text is

129:01

download correct now let's add the CSS

129:04

properties so in this div let's add the

129:07

class

129:08

name and here let's provide these

129:11

classes we will

129:12

provide Flex Gap Flex wrap justify

129:16

Center text fight text a small then

129:19

padding zero then margin top top and

129:22

Border radius that is rounded full after

129:26

that we'll add the classes in this P tag

129:28

so just add the class name and here we

129:31

will

129:33

provide background transparent border

129:36

border 900 text black padding X

129:42

padding y rounded full and cursor

129:46

pointer after that we will add the class

129:48

name in this a tag so

129:52

here let's add class name and in this

129:57

one just provide

130:01

this class name background Jin 900 that

130:05

is the background color then padding

130:07

from X and padding from y AIS rounded

130:10

full cursor pointer correct now whenever

130:14

we will click on this link that is

130:17

download it should download the image so

130:22

here we have to provide the

130:24

image and here we have to provide one

130:26

more attribute that is download so just

130:29

add

130:31

download that's it save the changes and

130:34

open the web

130:36

page here you can see we have generate

130:39

another and download button

130:43

correct now just come back and uh you

130:47

can see here it is displaying this input

130:49

field also and this button also so what

130:52

we have to do we have to either display

130:54

this input field or this button so what

130:59

happens whenever we don't have any image

131:02

then we will display this input field so

131:05

that user can type something and

131:07

generate the image and after generating

131:09

the image it will hide this input field

131:12

and it should display the download

131:14

button so that user can download the

131:16

generated image or user can click on

131:19

this button to generate another

131:22

image correct so either we have to

131:25

display this one or this one so just

131:28

come back and

131:30

here before this return

131:33

statement let me add some State

131:35

variables so first let's add const we

131:40

will add image and set image this Setter

131:46

function name is set

131:50

image and in this one we will add user

131:54

state to create the EST State variable

131:56

we are using user State and here we will

132:00

add the image so just add

132:03

assets

132:05

dot sample image 1 now instead of using

132:09

this assets. sample image 1 in this IMG

132:12

tag here we can use this state so simply

132:15

add this

132:17

image like

132:19

this correct

132:22

and after that if I scroll down here we

132:25

have added the hdf correct so in this

132:28

hdf let's add the curly

132:31

presses and provide this image state so

132:34

that whenever user will click on this

132:37

download button it will download this

132:39

image because we have added the download

132:43

attribute in this a

132:45

tag

132:47

correct now here we will create another

132:49

estate variable so let's add

132:53

const and we will add the

132:56

name is image loaded and the seter

133:00

function name

133:02

is set is image

133:06

loaded and here we'll add user

133:11

State then we'll add the initial value

133:15

so initialize it with

133:18

false so it means initially the image is

133:21

not loaded so when the image is not

133:24

loaded then what will happen we have to

133:27

display this one we have to display

133:31

this input fields that is added in this

133:35

div you can see the entire div this div

133:38

contains one input field and one button

133:41

so this div will be displayed whenever

133:43

the image is not loaded so here let's

133:47

add we will add the curly braces and

133:49

here we will add not

133:52

of is image

133:54

loaded then we will add the end operator

133:59

and here we will provide this

134:02

div so what we have to do we have to

134:04

just remove this curly Braes from here

134:06

and paste it here after this

134:09

div so when it is true then only this

134:14

will be displayed and come back to the

134:17

web page still you can see it is

134:19

displayed here because here we have

134:21

added not of is image loaded so is image

134:25

loaded is false and we are using the not

134:28

operator so so it becomes true so if it

134:31

is true then this div will be

134:35

displayed now we will add condition for

134:38

this div so here also we will

134:42

add cly bres and here simply add is

134:46

image loaded it means the image is

134:49

already loaded so in in that case we

134:51

will display this div because the image

134:55

is already loaded then user can download

134:58

the image or user can click on the

135:00

button to generate another image so just

135:04

move this curlys

135:06

here like

135:09

this now just come back to the web page

135:12

and here you can see we have this input

135:14

field and if I change it suppose we make

135:17

it

135:19

true now you can see what happens here

135:22

we have this generate another button and

135:24

download button correct that input field

135:28

is hidden because the image is already

135:30

generated so we can download the image

135:33

and if I make it

135:37

false then you can see again we have the

135:40

input field and we don't have the

135:42

download button next we have to add the

135:46

feature for loading image so let's come

135:49

back and uh

135:51

here let's add another estate variable

135:57

const and we will add variable

136:01

name or a state name

136:06

loading and the setter function name is

136:09

set

136:12

loading is equal

136:15

to user State and write the initial

136:19

value false so initially loading is

136:26

false so when the loading is false then

136:29

what we have to do we have to hide this

136:32

one this text

136:35

is displayed by default so we have to

136:37

hide this one whenever the loading is

136:40

false so in this P tag we will add the

136:43

class

136:45

name and here just add curly Braes

136:53

now in this one we will

136:55

check not of

136:58

loading then what happens we will add a

137:03

class name called

137:07

hidden and if the condition is false

137:11

then we will add empty class name that

137:14

is empty

137:15

string that's it now just come back and

137:19

here you can see that loading text is

137:21

hidden and when I make it false or make

137:24

it

137:25

true it means the loading is true

137:28

correct so when the loading is true it

137:30

will display this loading text now just

137:33

come back and let me make it

137:37

false so it will be hidden now let me

137:40

come back to the web page and you can

137:43

see here we have the input field so let

137:45

me hide this input field so for that

137:49

here we have to make it

137:53

true so you can see the input field is

137:56

hidden and here we have the download

137:57

button that will download the image and

137:59

here we have the generate another button

138:01

so now we have to add the click

138:03

functionality on this generate another

138:06

button correct so just come back and uh

138:12

here we have

138:15

this button generate another in this P

138:18

tag so in this P tag we will add the on

138:21

click property so let's add a space here

138:24

and here we will add on

138:26

click and in this one we will add one

138:29

Arrow

138:33

function and uh here we will call the

138:37

setter function that is set is image

138:40

loaded and we will make it

138:45

false so whenever it is false then it

138:49

will display the input field so let me

138:52

just click on this button now you can

138:54

see here it is displaying the input

138:56

field Let me refresh

138:58

it click on this generate another button

139:01

it is displaying this input field so

139:03

this click feature on this button is

139:05

working fine correct so now again let me

139:09

make it

139:11

false so by default the input field will

139:14

be

139:15

displayed after that here you can see we

139:18

have added this

139:21

width full for this span tag so here we

139:24

will make the width zero and so whenever

139:28

the loading is true then the width will

139:31

be full and whenever the loading is

139:34

false then we will add the width zero

139:38

for that let

139:40

me remove this single quote and we will

139:43

make

139:44

it back

139:46

tis like this and we have to wrap it in

139:49

curly brushes

139:51

correct so we have wrapped this class

139:54

name in curly bres and we have added the

139:56

back Tex

139:58

also and after that you can see we have

140:01

added width full transition all dation

140:05

this one correct

140:07

so just remove it and here we will add

140:12

dollar sign curly bres we are using

140:15

template literal so just add loading and

140:18

we will check if the loading is true

140:20

then we will add these classes that is

140:23

width full transition and

140:27

duration after that here we will add the

140:31

colum if it is false then what will

140:33

happen it will add the width

140:36

zero so just add width

140:40

zero we have to add one single quote

140:46

here now it is

140:48

correct save the changes and come back

140:50

to to the web

140:52

page now you can see that blue

140:54

horizontal line is hidden and if I make

140:57

it true in this loading if I make it

141:02

true then you can

141:04

see this horizontal line is displayed

141:07

and this loading text is displayed and

141:10

if it is

141:12

false then that horizontal line is

141:14

hidden and that loading text is also

141:17

hidden correct next next we will create

141:21

one state variable that will store the

141:24

data that we will type in the input

141:26

field so here just add

141:30

const a state variable name is

141:36

input and the set function name is set

141:41

input equal to user State and initialize

141:46

it with empty

141:48

string now we have to link this

141:51

a state with the input field so let me

141:55

just copy this set input and scroll down

141:59

here we have this input field correct so

142:01

in this one let's add a space and here

142:05

let's add on

142:08

change we will use this on change

142:11

property and here just add e and we'll

142:16

add the arrow

142:18

function and then provide this set input

142:22

and in this one we have to provide the

142:24

value that is typed in this input field

142:27

so just add e do Target dot

142:33

value now we will add the value property

142:36

in this input field so just add the

142:38

value and here just add the state input

142:43

that's

142:44

it so now whatever we will type in the

142:47

input field that will be stored in this

142:50

input a state and using this input a

142:53

state we will generate the image after

142:57

that here you can see we have created

142:59

this form tag and here we have this

143:01

button to submit this form you can see

143:04

in this button we have added the type

143:05

submit so whenever we will submit this

143:08

form it should execute one function so

143:11

we will create one form submit Handler

143:14

function so here before this return

143:18

let's

143:19

add cons

143:22

we will add the function name on submit

143:29

Handler equal

143:31

to I in we will add the form submit

143:37

event it will get the event here and

143:39

then we'll create the arrow

143:41

function now we will complete this

143:44

function later whenever we will create

143:47

the back end of our application and next

143:51

we have to link this function with this

143:52

form tag so in this form tag we will add

143:59

onsubmit and in this clys just provide

144:03

this function on submit Handler that's

144:05

it so whenever we will submit this form

144:08

it will execute this function and we

144:09

will complete this function after

144:11

creating the back end of our application

144:15

so now let me just come back to the web

144:17

page and you can see we have completed

144:19

our result page now let me just come

144:23

back to the figma design and you can see

144:26

after completing

144:28

this result page we have to create this

144:32

price plan page correct so to create

144:35

this one let me just come

144:38

back and in this left side bar we will

144:42

come

144:44

to by credit. jsx file correct and in

144:49

this one we have added

144:51

this text called Buy credit so if I come

144:54

back to the web browser and here we will

144:58

add by in this URL path so it will

145:02

display this by credit then then header

145:05

and footer correct so just remove this

145:08

by creit text here in this div we have

145:11

to add some elements so let me just come

145:14

back to the figma design again and in

145:16

this one you can see first we have to

145:18

create this button called our plans then

145:21

we have to add this title then we will

145:23

display the price plan in three columns

145:26

and we have the details of this price

145:28

plan in the assets. JS file correct so

145:32

just come back and within this div let's

145:36

add one

145:39

button and in this button we will add

145:42

the button

145:44

text our plans and after that we'll add

145:48

the title in H1

145:50

so in this one we will add the text

145:55

called choose the

145:57

plan now we will add some CSS properties

146:00

so first in this div let's add the class

146:03

name and here we have to add the minimum

146:07

height then we will add text Center then

146:11

padding top and margin

146:14

bottom after that we'll add the classes

146:16

in this button so just add the class

146:18

name property for this button we will

146:20

add the classes so let's

146:24

add border border gray 400 padding X

146:28

padding y rounded full and margin bottom

146:31

six after that we'll add the class name

146:33

in this title so here just add the class

146:35

name property and in this one we have to

146:38

add text Center then we will increase

146:41

the text size 3XL then font medium

146:44

margin bottom and margin bottom for

146:47

small screen device after adding this

146:50

this save the changes and come back to

146:51

the web page and here you can see we

146:54

have this button our plans then we have

146:57

this title choose the plan correct next

147:01

we have to display different plans so

147:03

just come

147:04

back in the left side bar go to assets

147:07

assets. JS file and in this one here we

147:11

have one aray called plans and here we

147:14

have three object correct for three

147:17

different plans so we will use this

147:20

array to display the plans on our creit

147:24

page so here after this title that is

147:29

added in the H1 here we will add one new

147:33

div so just add the space and here let's

147:36

create one

147:40

div and uh in this one we have to add

147:44

the array so let's

147:48

add curly bres we will add the array

147:51

that is plans selected from the

147:55

suggestion so this plans has

147:57

been imported from assets file now on

148:01

this one we can use the map method so

148:03

just add

148:04

dot

148:06

map on this map we will add one addo

148:11

function and here we will use this a

148:14

small

148:15

bracket now here in this parameter we

148:18

will get individual

148:21

item and index

148:24

number and in this one we will return

148:28

one

148:30

div now in this div we have to add the

148:33

key property so just add key and

148:38

index correct now within this div we

148:42

have to add the image so just add the

148:45

IMG tag and here let's add

148:50

curly

148:52

bres assets

148:56

dot logo icon so we will add the logo

149:00

icon in the

149:02

image after that we will add the text in

149:04

P tag so let's add the P tag and here we

149:08

will

149:08

add

149:10

item. ID correct after that just

149:14

duplicate it and here we will add item

149:19

Dot

149:21

description correct and uh after that we

149:26

have to add the price also so here just

149:29

add the P

149:31

tag and in this one we have to

149:36

add item do price correct then we'll add

149:41

the forward slash and here we have to

149:45

display credit so just add item. credits

149:51

then we will add the

149:55

text credits correct after adding this

150:00

let's come back to the web page and here

150:02

you can see we have three plans

150:05

basic Advanced and business correct and

150:08

here we are getting 10 for 100 credits

150:12

50 for 500 credits let me add the dollar

150:15

symbol also so before this item. price

150:18

we will add dollar symbol

150:21

save the changes now you can see $10 for

150:24

100 credits $50 for 500 credits $250 for

150:29

5,000

150:31

credits here we are getting this lock

150:34

icon so let me just correct it yes here

150:36

we have added lock icon so instead of

150:38

this we will add logo

150:41

icon now we have these logo icon correct

150:44

if I go to figma design you can see we

150:46

have the same logo icon in all plan

150:48

correct so so now we have to add the CSS

150:51

properties to design the creit page so

150:55

after adding this content let's come

150:56

back and here we have added this div so

151:01

first We'll add the CSS properties in

151:03

this div so in this one let's add the

151:06

class name and we will provide Flex Flex

151:09

WP justify Center Gap six and text left

151:14

correct after that here we have this div

151:16

for the individual price plan so in this

151:20

div we will add the classes so just add

151:23

the class

151:25

name and we will provide background

151:28

white drop sideo small border rounded

151:32

large padding Y and padding X then we'll

151:35

add text color then we will add the

151:38

hover so whenever we will hover on it it

151:41

will increase the size then transition

151:43

all duration

151:45

500 after that we will add the CSS

151:48

properties for this P tag and before

151:51

that we have to add the width in this

151:53

image so in this image we will add the

151:55

width that is

151:57

40 now in this P tag where we have added

152:00

the item ID so let's add the class

152:05

name and uh in this one we have to add

152:08

some margin from the top and margin from

152:10

the bottom then we will add the font

152:14

semibold then we have this description

152:17

so in this description we will add the

152:19

class name

152:20

and we will provide text small correct

152:25

and after that we have this P tag where

152:27

we have added the price right so in this

152:29

P

152:31

tag let me add the class

152:35

name and here just provide margin top

152:39

six so it will add a space from the top

152:42

after that we have to wrap

152:45

this price in a span tag so so let's add

152:50

a

152:51

span and move this closing tag here

152:54

before this forward

152:56

slash correct now in this aspan tag we

152:59

will add the class name and uh

153:04

here let's

153:06

add text size 3 XEL and font

153:12

medium that's it save the changes and

153:14

come back to the web page now you can

153:17

see this price is looking good $10 for

153:21

100

153:22

credits correct after that we have to

153:25

add one button in all plans if I go to

153:27

figma design you can see we have one

153:29

button called get started right so just

153:32

come back and uh here after this a span

153:36

and

153:37

this P tag let me add one button

153:43

tag and in this button we will add the

153:46

button text called get started

153:50

correct now in this one we have to add

153:53

the class name so let's add the class

153:55

name

153:56

property and here let's

153:59

provide width full background gray 800

154:05

text color will be white margin top then

154:07

text a small rounded medium then padding

154:10

Y and minimum width correct after adding

154:15

this if I come back to the web

154:17

page this button looks like this

154:20

so let me just correct it here we have

154:23

to add the correct spelling

154:26

button now you can see it looks perfect

154:30

correct next we have to add different

154:33

text in this button suppose the user is

154:36

already logged in then we have to

154:39

display the button text called purchase

154:41

and if the user is not logged in then we

154:44

will display the text called get started

154:47

this one right for that we have to get

154:50

the user here in this Buy credit page so

154:53

if I open our app context you can see in

154:56

this app context we have already created

154:58

this user State correct so we can get

155:02

the user state from this context file in

155:05

this by credit page so before this

155:08

return statement let's

155:11

add

155:13

const curly presses

155:17

user and we will get this user

155:21

from use

155:25

context use context hook and here we

155:28

have to provide our

155:29

own context file that is app context so

155:34

you can see app context has been

155:36

imported and this use context has been

155:38

imported correct so now we have this

155:41

user and based on this user we will

155:43

update this button text so here let's

155:47

add Cly bres we will use this user we

155:52

will add turn operator if the user is

155:54

available then we will display the text

155:57

called

156:00

purchase like this and here we will add

156:03

the column so if the user is not

156:06

available then what will happen we will

156:08

display this get a started text so add

156:11

it in this code get started save the

156:15

changes come back to the web

156:17

page now you can see the text called get

156:20

started correct now just come back and

156:23

uh from this app context if I make it

156:26

pro in this user we will make it

156:30

true now you can see here we have the

156:33

button text called purchase

156:36

correct and if I make it

156:40

false or

156:43

null then you can see here we have get

156:47

started correct so now we have completed

156:50

our Buy credit page also after that we

156:53

have to create this signin and sign up

156:58

component to create that let's come back

157:00

to the VSS

157:04

code let's open the left side bar and

157:06

here we have this components folder so

157:10

in this components folder we will create

157:12

a new file and write the file name

157:15

login. jsx

157:20

here we will use RFC

157:26

snippet now we have to display this

157:30

login form on the complete web page and

157:32

there will be a dark layer on the

157:34

complete web page so in this div we are

157:38

going to add the class

157:41

name and in this class name we will

157:44

provide the position absolute so it will

157:46

be fixed at its position then we will

157:49

add left Z Top Z right Z and bottom

157:53

zero so it will cover the entire screen

157:56

after that we will add the J

157:58

index then backdrop blur small so the

158:02

background will be blur after that we

158:05

will add the background color and the

158:08

background color opacity is 30% then we

158:12

will add Flex justify Center and item

158:14

Center so that when we will add a form

158:17

within this div that form will be Ed in

158:19

the center of the web

158:22

page now within this div we have to add

158:25

a form so let's add a form

158:31

tag remove this

158:34

action now in this form we have to add

158:38

three input field that will be for the

158:40

user name email and

158:43

password but before that we have to add

158:46

one title also like sign in or sign up

158:50

or I can add the login also so in this

158:54

form tag let me add one title in

158:58

H1 and in this title let me add the

159:03

title

159:05

text login or instead of it we will

159:11

add sign

159:13

up correct and after that we'll add one

159:17

text also so let's add the P tag and in

159:20

this one we will add this

159:22

text so after this title and text we

159:26

have to add one div and within that div

159:30

we will add the icon and input field so

159:34

let's add one

159:36

div and within this div first we have to

159:39

add one icon so just add the IMG tag in

159:44

this SRC we will use the

159:47

assets assets is not available so let me

159:50

import

159:52

that

159:54

import assets

159:57

from dou

159:59

do/ assets SL assets file now from this

160:05

assets we can access any icon so let me

160:10

add the

160:12

icon user uncore

160:16

icon after this icon we will add the

160:18

input field so I'll add the input type

160:23

will be text and in this input field we

160:26

will add the placeholder so in the

160:29

placeholder we will type full name where

160:32

user have to enter their full name after

160:35

that we will add

160:38

required so this field will be required

160:41

to submit the

160:43

form after adding this if I save the

160:46

changes and come back to the web page

160:52

that form is not visible here because we

160:54

have not mounted this component so we

160:57

have to mount this login component in

160:59

this app component so in this app

161:02

component we will Mount the login

161:05

component so here after this navigation

161:09

bar let's

161:13

add login selected from the suggestions

161:16

so this login component has been

161:18

imported

161:19

and

161:21

let's close this tag so we have mounted

161:24

this login component in this app

161:26

component and after that if I come back

161:29

here you can see we have a background

161:32

layer on the complete screen and here in

161:34

the center we have the text sign up

161:37

welcome back please sign in to continue

161:39

and here we have the input field and

161:42

that icon is not visual yes it is visual

161:45

here it is in light color so we will

161:47

change the background color then it it

161:49

will be visible clearly now just come

161:52

back we will add some CSS

161:54

properties and uh let's come back to the

161:59

login. jsx file so first let's add the

162:03

CSS properties for the form tag so you

162:06

can see we have added the form tag here

162:09

so in this form tag we will add class

162:13

name and in this one we have to add

162:17

position relative then background then

162:21

we will add the padding then rounded

162:24

Excel so that the corners will be round

162:27

and after that we'll add text slate 500

162:31

that will be the text

162:33

color correct and after that we have to

162:36

add the classes in the title that we

162:41

have added in H1 tag so in this H1 we

162:43

will add the class name text Center we

162:46

will increase the text size text neutral

162:50

700 then font medium after that we will

162:54

decrease the size of

162:56

this text written in the P tag so here

162:59

just add the class name and we will

163:01

provide text a small after that we will

163:03

add the CSS properties in this div where

163:06

we have added the icon and input field

163:09

so in this one let's add the class

163:13

name and we will provide border padding

163:17

X padding y Flex item Center gap of two

163:22

pixel rounded full and margin top so

163:27

this icon and input field will be

163:29

aligned side by side now we have to add

163:32

the classes in this input field so in

163:36

this one we will add the class

163:39

name and here we will provide outline

163:42

none and text a small after adding this

163:47

save the changes and just come back to

163:49

the web

163:50

page now you can see we have this title

163:53

sign up then we have this text and after

163:55

that we have this small icon for user

163:59

then we have this text full name correct

164:02

that is the placeholder text so we have

164:05

added the first input field now we will

164:08

add two other input field also so just

164:11

come back and uh we will just duplicate

164:13

this

164:15

div so let me just copy and paste it

164:18

again

164:22

now in the second one we have to update

164:25

the icon so it will

164:27

be email icon and in the third one we

164:31

will add lock

164:35

icon so we have updated the icon and

164:38

after that we have to update the

164:41

placeholder text so in the second one we

164:43

will add the placeholder text called

164:46

email ID so here we have the the

164:49

placeholder text full name so instead of

164:51

that we will add the email ID now in the

164:54

next one we will add the placeholder

164:55

text called

164:57

password and we will also update the

165:01

input type so in the second one we will

165:04

add the input type

165:06

email and uh in the next one let's add

165:10

the input type

165:13

password correct now just come back to

165:16

the web page here we have three input

165:18

fields

165:19

we have to reduce the Gap so let me just

165:22

come back here in the first one we have

165:25

added margin top five so instead of that

165:29

we will add margin top four in this one

165:32

and in the third one also so we have

165:35

updated the space from the

165:38

top correct and after this input field

165:41

we have to add one text so we will add

165:44

the P tag and in this one we will add

165:46

the text called for password so that

165:50

user can click on this link if they

165:53

forgot the password now in this P tag we

165:55

will add the class name property and

165:57

here we have to add some classes so

166:00

let's add text a small then text color

166:05

that is blue 600 then margin Y and

166:08

cursor pointer after that there will be

166:11

one button to submit this form so we

166:13

will add the button tag and in this

166:15

button we have to add the button text so

166:19

let me add the button text create

166:22

account and in this button we will add

166:24

the class name also so just add the

166:26

class

166:27

name and here we have to provide the

166:30

background color for this button and we

166:32

will add the width so we have added blue

166:35

600 background then width full then text

166:38

white and we will add the padding after

166:40

that we have added rounded

166:44

full so after adding this let's come

166:47

back to the web page now you can see

166:49

here we have the forgot password and

166:51

create account button correct after this

166:55

create account button we will add the

166:57

message to switch this form from login

167:00

to sign up or sign up to login for that

167:04

just come back and uh after this button

167:08

let's add one P tag so in this P tag we

167:11

will add the text called don't have an

167:14

account so if you don't have an account

167:17

then there will one link for sign up so

167:21

just add a span

167:23

tag and in this as span tag we will add

167:27

the link text called sign

167:29

up correct now in this P tag we have to

167:33

add the class name and here let's add

167:37

the margin from the top and we will add

167:41

text

167:42

center after that we have to add the

167:44

class name in the span tag so here we

167:48

have the span tag and in this one we

167:50

will add the class name and we will

167:52

provide text color then cursor

167:55

pointer after adding this if I come back

167:58

to the web page here you can see we have

168:00

the message don't have an account sign

168:02

up correct now we will add one more

168:05

message so let's add a space and

168:08

duplicate this

168:10

line and in this one we will replace the

168:13

message so it will be already have an

168:17

account

168:19

correct and if we already have an

168:21

account then there will be a link called

168:25

login so we can change the form to

168:30

login correct after that if I come back

168:34

and you can see now we have two message

168:35

don't have an account sign up and there

168:38

is another link already have an account

168:42

login next we have to create the switch

168:44

option so that we can switch between

168:47

login and sign up form for that we have

168:50

to create one state

168:53

variable so let's come back and before

168:57

adding that switch let me add one close

169:00

icon also using that we can close this

169:02

form so here at the end let's add the

169:05

IMG tag and in this one we will add the

169:09

image from

169:11

assets assets

169:14

dot cross

169:16

icon and for this one one we have to add

169:19

the class name so just add the class

169:21

name and here we have to provide the

169:25

position that will be absolute then top

169:29

five right five cursor pointer that's it

169:33

save the changes and here you can see we

169:35

have a cross icon also that is not

169:37

working right now but we will add the

169:39

functionality so that when we click here

169:41

it will hide this form but before hiding

169:44

it let me add the switch option to

169:47

switch between login and sign of form so

169:49

whenever we will go to login form then

169:52

we have to hide this name input field we

169:55

have to enter the email ID and password

169:58

only to login into the account so there

170:01

will be two input field email ID and

170:04

password when we will switch to login

170:06

form so just come back and at the

170:11

top before

170:13

this

170:16

return here let's add one state aable so

170:19

I'll will add

170:21

const

170:24

estate set

170:26

State equal to user State user state has

170:31

been imported and here we will add the

170:34

initial Estate Value so the initially it

170:37

will be in the login

170:39

State login

170:42

correct now we will use this state to

170:45

change the message so let me just call

170:48

copy this estate and here you can see we

170:51

have added the message called sign up so

170:53

instead of sign up we will provide this

170:56

a state so let's add curly Braes and

170:59

provide a state here that is the state

171:02

variable correct after that you can see

171:06

here we have this div that is for the

171:09

name input field we have added the

171:12

placeholder full name so it will be

171:14

visible whenever the estate is sign up

171:18

or not equal to login so we have to wrap

171:21

this div in a clys like this and before

171:25

this div we will

171:27

add

171:30

State not equal

171:32

to

171:34

login question mark a state not equal to

171:38

login and operator so whenever the

171:42

estate is not equal to login then this D

171:46

will be displayed so after adding this

171:48

if I come back to the web page you can

171:50

see that name input field has been

171:53

removed and here we have the message

171:55

called

171:57

login correct after that let's come

172:01

back and uh here you can see we have a

172:06

button and in this button we have added

172:09

the message called create account

172:11

correct so instead of adding this

172:13

message create account we will use the

172:16

Turner operator so in this this button

172:19

also we will add cly

172:22

bres and we will

172:24

check state if the estate is equal to

172:30

login

172:33

then we will add the button text called

172:36

login correct and if the estate is not

172:40

equal to login then we will add the

172:42

button text called create account like

172:45

this so we have added this turn operator

172:49

after that here also we have two message

172:52

so we have to display only one message

172:54

based on the estate so let's wrap this

172:59

one in a

173:01

curlys and here let's add a

173:05

state equal

173:08

to login so if the estate is equal to

173:11

login then we will display this message

173:14

sign up correct and here we will add the

173:19

colum it means when the estate is not

173:22

equal to login then the second paragraph

173:25

text will be

173:28

displayed so we have added this turn

173:31

operator to display different paragraph

173:33

text correct save the changes and come

173:36

back to the web page now you can see

173:38

here we have this login form with email

173:41

ID password and login button then we

173:45

have this don't have an account sign up

173:48

correct so we have the login form so we

173:50

can switch from login to sign up using

173:53

this link but now we have to add the

173:55

functionality in this signup link so let

173:57

me just come back and here we have this

174:02

a span tag called sign

174:04

up correct so in this one we have to add

174:07

the click feature

174:10

so here let's add on click and in this

174:15

one we will add one add function

174:19

and here simply add set a state that

174:25

Setter function that will change the

174:27

estate value and here we will add the

174:29

estate called sign

174:32

up that's it let me just copy this

174:35

one and paste it in this second

174:38

paragraph also within this aspan

174:40

tag so

174:43

here after this class name let's add on

174:47

click equal to set a state and here we

174:49

will add the state called login so it

174:53

will change the state between sign up to

174:56

login now just come back and uh right

174:59

now you can see we have the login form

175:01

and if I click on this sign up link now

175:04

you can see the sign up form with three

175:07

input field name email and password and

175:10

here we have the message already have an

175:12

account then login here just click here

175:15

so it will open the login form so we can

175:17

switch between login and sign up

175:20

form next we have to add the

175:23

functionality so that when we click on

175:25

this cross icon it will hide this login

175:29

form and whenever we will click on the

175:31

login button it will again display this

175:34

login form and right now you can see if

175:36

I scroll this web page we are able to

175:38

scroll let me just come back to the

175:43

homepage right now we are at the

175:45

homepage and you can see if I scroll

175:47

this we can scroll this web page so we

175:50

have to disable the scrolling whenever

175:53

this login form is open for that just

175:56

come back scroll up before this return

175:59

statement and here let's add one use

176:06

effect in this one we will add the arrow

176:09

[Music]

176:11

function and after that we will add the

176:13

dependency

176:15

aray so this add of function will be

176:19

executed whenever the component gets

176:22

loaded now in this one we have to

176:24

disable the scrolling so here let's add

176:29

document. body. style. overflow

176:32

hidden and uh here we will

176:36

add

176:38

return then let's add Aro

176:42

function and in this one we will

176:45

add document. body. style do overflow

176:51

unset so after adding this use effect

176:53

Whenever there will be change like Mount

176:57

and unmount of this login component then

177:00

it will hide the Overflow it mean it

177:02

will disable the scrolling and it will

177:04

also enable the scrolling so just come

177:07

back and you can see right now if I use

177:10

the mouse wheel we cannot scroll this

177:13

web page because this component is open

177:15

this login form is open so we cannot

177:17

scroll this web page so we have disabled

177:20

the scrolling and whenever we will close

177:22

this component and this component will

177:24

be unmounted then we will be able to

177:27

scroll this web page again so now we

177:30

have to add the close and open

177:31

functionality for this login form so

177:34

just come

177:35

back and we have to add one state

177:39

variable and we will use that state

177:41

variable in different components that's

177:44

why we will declare that in the context

177:47

file so here we have added the app

177:49

context where we will store all our

177:52

context variables so here we have

177:56

already declared a user state so after

177:59

that let me add const so

178:06

login and here we will

178:09

add set so

178:13

login and initialize it with false

178:18

so by default this set so login will be

178:21

false it means the login form will be

178:23

hidden next to use this state and set

178:26

function in different component we have

178:28

to pass it using this value so let's

178:31

copy it and in this one we'll add the

178:35

comma and provide this one we will

178:37

provide the setter function also that

178:40

is set so

178:44

login now we can access it in any

178:47

component using the

178:49

context so let's come back to this

178:52

login. jsx again and here we have to get

178:57

that so login and set so login from the

179:02

context so here let's add const we will

179:07

get

179:09

set so

179:13

login and we will get it

179:16

from use context

179:19

select it so use context has been

179:22

imported and here we have to provide the

179:24

context name that

179:26

is app context so this app context has

179:30

been

179:31

imported now we will use this set so

179:33

login to disable or hide the login form

179:37

so after importing it let's scroll

179:41

down and we will come to cross icon so

179:45

you can see here we have this

179:49

image where we have added the cross icon

179:52

so in this image let's add the onclick

179:55

property and in this on click we will

179:57

add the arrow

179:59

function and provide this set so login

180:03

and here we will make it

180:05

false correct and before that here we

180:10

have this form so we have added the

180:13

click functionality on this cross icon

180:16

and here you can see we have this

180:18

login form now just come back and we

180:21

will come to app.jsx file and in this

180:24

app.jsx file you can see we have mounted

180:26

the login component correct now we have

180:30

to add the condition for this login

180:32

component so here also we need the so

180:36

login State variable so we have to get

180:40

it from the context so just

180:42

add

180:44

const CES

180:48

so

180:49

login and we will get it

180:52

from use context Hook and the context

180:57

name that is app context now we have the

181:01

so login and if this so login is true

181:05

then only we have to display this login

181:08

component correct so here let's add it

181:13

in the clys and we will

181:16

add so login

181:19

then we will add the end operator so

181:22

whenever this so login is true then only

181:24

this login component will be mounted now

181:27

save the changes and come back to the

181:29

web

181:30

page right now you can see that login

181:33

form is hidden correct now to enable

181:37

this login form we have to add the

181:39

functionality on this login

181:41

button here we have this login button

181:44

correct so let's come back and we will

181:47

go to navigation bar so here we have the

181:51

Navar component and in this Navar

181:54

component you can see we have added this

181:58

login button here it is so here we have

182:01

this login button now on this login

182:04

button we have to add the click

182:06

functionality that will make the set so

182:09

login State true so here also we need

182:13

the set so login from the context so you

182:16

can see we have already used the context

182:18

here we are getting the user from

182:20

Context so from this context we will get

182:23

the

182:25

set so

182:27

login now just copy it and here in this

182:31

login button we will add the on click

182:35

property and add the addo

182:38

function and provide this Setter

182:40

function and here we will make it true

182:43

so that this component that is the login

182:47

component will be

182:49

visual make it true save the changes and

182:52

come back to the web page now you can

182:55

see we have the login button and if I

182:57

click here it is displaying this login

183:00

component and we can switch between

183:02

login and sign up

183:06

form correct and now if I click on this

183:09

cross icon you can see it will hide this

183:11

login form correct the login form is

183:14

hidden and if I click on the login

183:16

button again it is visible and we cannot

183:19

scroll this web page and if I click on

183:21

cross icon now again we are able to SC

183:24

scroll this web page so now we have

183:27

created the login component also so now

183:31

we have created all the pages and

183:34

components for this app next we have to

183:36

add the animation for that we will use

183:39

the framer

183:41

motion to add animation let's open a new

183:45

tab and search for framer motion

183:48

open this

183:50

website then click on quick

183:54

start in the left side you can see we

183:56

have Js and react so let me click on

184:00

react then click on quick

184:04

start and here you can see we have the

184:07

steps to use the frame and motion in

184:10

your react project so scroll down and

184:13

here you can see the command npm install

184:16

motion just copy it and come back to

184:19

your vs code let's open the

184:22

terminal and here we have to stop this

184:25

project using crl C Y press enter now

184:29

use this command npm install motion

184:32

press

184:35

enter after that again I start the

184:37

project using npm run

184:40

Dev so our project is running now we can

184:43

hide this

184:44

terminal and let's see the next step

184:48

after completing this npm install motion

184:51

let's scroll down and here you can see

184:53

the next step is to import motion from

184:56

framer motion so you have to import this

185:00

Motion in the component where you want

185:02

to animate the elements so let me just

185:06

copy it and come back to the vs code and

185:09

I want to add the animation in header

185:12

section so let's open header. jsx file

185:15

and in this one here we will add this

185:18

statement import motion from framer

185:21

motion correct now just come back and

185:24

here you can see the next step is to use

185:27

this motion component so whenever you

185:30

using div component or any HTML element

185:34

then in that one you have to add the

185:37

motion if you are using div then it will

185:40

be motion do D if you are using UL then

185:43

it will be motion. UL if you are using

185:48

IMG then it will become motion. IMG

185:51

correct so let's come back and here you

185:54

can see in this header

185:56

component we have this div so we have to

186:00

add motion. div opening and closing tag

186:04

also so if you add the motion. div in

186:08

this opening div tag then you have to

186:10

add the same thing here in this closing

186:12

div tag motion. div so here I have added

186:16

one extension you can see in my

186:19

extensions we have one Auto rename tag

186:25

correct so whenever you will rename the

186:27

opening tag it will automatically rename

186:29

the closing tag so it makes your work

186:32

easy so let's come back and here if I

186:35

change the name of this div it means

186:39

I'll

186:40

add motion. div like this so we have

186:45

added motion. div

186:48

then it will automatically change my

186:50

closing tag you can see it is closing

186:52

motion. div done so it makes my work

186:56

easy now let's come back and you can see

186:58

what we can add further in this motion

187:02

component so we can add like this

187:04

animation

187:06

x00 let's just scroll down we can add

187:08

like this animation scale

187:12

transition we can add the initial value

187:16

animate

187:18

here you can see we can add the while

187:20

hover what will happen when we will

187:22

hover on this

187:24

element on H start while tab so we have

187:28

different properties for this motion

187:32

component let me scroll down here you

187:35

can see we have V in view

187:39

suppose the component is not visible but

187:43

when we scroll the web page then the

187:44

component becomes visible so in that

187:47

case we we have to add this while in

187:49

View and here we have the initials so we

187:53

can set the initial value for that

187:55

component like in this example you can

187:58

see initially the background color is

188:01

this one and the opacity is zero but

188:03

whenever we will scroll the web page and

188:05

this div will come into view then the

188:08

opacity will become one and the

188:11

background color will be this

188:13

one and we can also add the duration

188:18

so we will use these properties to

188:20

animate our component

188:23

so let me close it and just come back to

188:26

the vs code and here we have this

188:29

motion. div so in this element let's add

188:33

a

188:35

space and here let's add the initial

188:39

value so I'll add initial and here let's

188:43

add curly

188:45

brushes and initially we will add the

188:48

opacity so the opacity will be

188:53

0.2 then we will add

188:57

y so y will be 100 so initially the

189:01

opacity will be less and it will be

189:04

moved in the Y AIS then after some

189:08

duration like 1 second so here let's add

189:13

transition and in this transition we

189:15

will add d

189:20

so we will provide the duration of 1

189:23

second so after 1 second we will add

189:28

while in

189:30

view opacity 1 and y0 so it will be

189:35

visible clearly when we add the opacity

189:37

1 and we have added y0 so it will come

189:41

back to the original position initially

189:43

it will be moved by

189:45

100 after that we have to to add

189:48

viewport once

189:51

true so after adding this if I come back

189:55

to the web page and refresh

189:57

it now you can see the animation here by

190:01

default the opacity was less and it was

190:04

moved downwards and when we reload this

190:08

web page it comes into view and it moves

190:10

up correct and it's come to the original

190:13

position with the opacity

190:16

100% now now we will add the animation

190:18

in this text which is written in this

190:21

button right so here we have added this

190:24

another div so here we will change it

190:27

as motion

190:31

DOD correct and in this one also we will

190:33

add

190:34

the properties so let's copy everything

190:38

from here and here let's add a space in

190:42

this tag and here we will add the

190:44

initial and initially we will add the

190:46

opacity

190:48

0 and we will add y - 20 and here we

190:52

will

190:53

add animate so instead of this while in

190:58

view we will add animate and here we

191:02

will add

191:03

y0 and opacity will be

191:06

one and let me remove this

191:10

transition here you can see the initial

191:12

opacity is 0 and Y - 20 then animate

191:16

opacity 1 y0 correct and after that here

191:20

we will add

191:23

transition duration duration I will add

191:27

0.8 and here we will add the delay also

191:30

so just add

191:32

delay

191:35

0.2 so you will see this animation after

191:38

delay of 0.2

191:40

seconds so just come back and refresh

191:44

it now you can see we have some delay in

191:47

this

191:49

animation in this best text to image

191:54

generator correct now we will animate

191:59

the text that is written here in this H1

192:04

tag correct so just come back and here

192:08

for this H1 we will

192:10

add motion.

192:13

H1 now here let's add the

192:18

space in this H1 tag and here let's add

192:22

initial value so we will add initial

192:25

opacity zero correct now we will add the

192:29

animate so after animate the opacity

192:32

will be one then we will add transition

192:36

and here also we will add the delay and

192:38

duration 2 seconds correct save the

192:41

changes come back to the web page

192:43

refresh it now you can see we have some

192:47

delay in this animation that is the

192:50

title text correct after that we will

192:54

add the animation in this description

192:57

which is written in the P tag so here in

192:59

this P tag we will

193:01

add motion

193:03

dop and uh here in this P tag with the

193:10

motion we will add the properties for

193:13

animation so we will add initial opacity

193:15

0 y20 animate opacity 1 y 0 so it will

193:19

come to original position then we'll add

193:22

some DeLay So we are increasing the

193:24

delay you can see here we have added

193:26

delay 2 4 and 6 and the duration is

193:32

0.8 correct after that we'll add the

193:34

animation in this button so here in this

193:37

button also we will add motion do button

193:41

correct and in this button we will add

193:44

the properties for

193:47

animation so let's

193:50

provide while hover scale then while tap

193:55

scale then initial opacity zero animate

193:59

one then we'll add the transition

194:02

default duration. 5 opacity delay point8

194:08

duration 1 that's it after that if I

194:11

come

194:12

back refresh it now you can see we have

194:16

animation in the button also and you can

194:18

see the size increases when we take

194:20

cursor over this button or when we click

194:23

here it is also increasing the size

194:26

correct so it is happening because of

194:28

this framer motion now we will add the

194:32

animation on this div where we have

194:34

added all the images and we will add the

194:36

animation on individual image also so

194:39

just come back and here we have

194:42

this div right so in this div let's add

194:50

M.D now here let's add some properties

194:53

for the animation so we will provide

194:55

initial value then animate and

194:57

transition so we have provided initial

195:00

opacity zero animate opacity 1

195:03

transition delay one and duration one

195:06

after that we will add the motion in

195:08

this IMG tag so just add

195:12

motion do

195:15

IMG and uh here let's add V hover so

195:21

while hover we will add a scale and

195:24

duration that's it after that scroll

195:27

down and here we have another text in P

195:29

tag so in this one also we will add the

195:31

animation so just add

195:33

motion

195:35

dop and uh here we will add the

195:39

animation

195:40

properties so initially the opacity will

195:43

be zero then opacity 1 and we will add

195:46

the delay and

195:48

like this save the changes come back to

195:50

the web page Let me refresh it and you

195:53

can see we have the animation in all the

195:55

contents from this text this button this

196:00

image it looks

196:04

beautiful after that we have to add the

196:07

click feature on this button so that

196:09

when we click here either it will open a

196:11

login page or it will redirect us to the

196:14

result page suppose you user is already

196:17

logged in then it will redirect us to

196:20

the login page and if the user is not

196:22

logged in then it will open a login form

196:25

for that just come back and here you can

196:28

see we have added this button right

196:30

generate images correct so here we have

196:33

this button so on this button we have to

196:35

add the on click

196:37

property and in this on click we will

196:40

add one Handler function so let me add

196:43

the function on click Handler

196:47

and we have to declare this function so

196:49

scroll up and here before this return

196:52

statement we will add one function so

196:56

just add const on click Handler and it

197:00

will be one add function now in this one

197:04

we have to check whether the user is

197:06

already logged in or logged out and

197:10

based on that we have to redirect the

197:12

user on result page or we will open the

197:15

login form so for that we have to get

197:18

the user status and set so login from

197:21

the context so here let's add const we

197:27

will get the user and we will also get

197:30

set so

197:33

login and we will get it from Context so

197:36

just add use

197:40

context and provide the app

197:43

context now we can check we will

197:47

add

197:49

if if the user is available then what

197:52

will happen we will navigate the user on

197:54

result page for that we have to use the

197:56

use navigate hook so here just add

198:00

const

198:02

navigate equal to use

198:07

navigate and now we will use this

198:09

navigate function

198:12

here here we have to provide the path so

198:15

just add the path

198:18

result correct now we will add the else

198:21

condition it means when the user is not

198:24

logged in then it will open a login form

198:27

so here we have added this Setter

198:29

function so just add this Setter

198:31

function and we will make it

198:34

true that's it so after that if I come

198:37

back to the web page you can see here we

198:39

have these text and button so if I click

198:41

on this button it will open a login form

198:43

we can close it like this if I click

198:45

again it will open the loog form and if

198:47

the user is already logged in then it

198:50

will redirect the user on the result

198:52

page now let's scroll down and here we

198:55

have the other section that is steps so

198:58

we will add the animation in this steps

199:00

section so just come back to the vs code

199:04

and we will open a steps. jsx file and

199:08

uh in this one scroll

199:11

up here you can see we have this div so

199:15

in this div we have to add the animation

199:19

so first we have to use the import

199:21

statement so here let's

199:24

add import motion from framer motion

199:27

correct now in this div we will rename

199:30

the tag so just add motion. div now

199:36

after that we can use the animation

199:38

properties so here we will change the

199:40

initial value and value while in the

199:44

view so here just add initial capacity 2

199:48

and Y 100 so when we will scroll the we

199:51

page and we will and this element will

199:54

come to the view then the opacity will

199:57

be one and it will come to the original

199:59

position and here we will add the

200:00

duration of one then we put once true

200:05

now save the changes and come back to

200:06

the web page scroll up and you can see

200:10

here we have the header section and

200:12

whenever we will scroll the web page and

200:14

come to our a steps section then only

200:18

the animation will start let's

200:22

see now you can see when I scroll to the

200:25

web page then only the animation starts

200:27

and this steps section comes with some

200:32

animation correct now we'll add the

200:34

animation in this description section so

200:36

just come back and let me close

200:38

it close this headed also and here we

200:42

have this description. jsx file

200:47

here also we will add the import

200:49

statement so let's

200:51

add import motion from frame or motion

200:55

correct and after that in this div we

200:58

will

200:59

add motion. div and here we will add the

201:03

animation properties so in this one we

201:06

will add initial value then we will add

201:10

the transition then we will add while in

201:13

View and we

201:15

put one

201:17

true like this save the changes after

201:21

that we will add the animation in the

201:24

next section so after this description

201:26

let's see here we have this testimonial

201:30

section so just come back and we will

201:32

open testimonials so let me just copy it

201:35

and open testimonials.

201:38

jsx scroll up and here we will

201:42

add motion. div and here we'll add the

201:46

anim

201:48

properties and in this one we will add

201:52

initial then we will add transition

201:55

while in View and viewport once true and

202:00

after that we have to add the import

202:02

statement also so just add

202:05

import motion from framer

202:07

motion correct after that you can see we

202:11

have the another section that is this

202:12

one see the magic and this button so

202:16

here we we have created one component

202:19

called generate bn. jsx let's open it

202:23

and here also we will add the import

202:25

statement correct and in this one we

202:28

will add the motion in this

202:32

div motion. div and here also we will

202:36

add

202:37

the animation properties so here let me

202:43

add initial

202:47

then transition

202:49

then viewport so after adding this let's

202:54

come back and you can see if I scroll

202:56

the web

202:58

page all the contents are coming with

203:01

some

203:05

animation correct now we have to add the

203:09

click feature on this button which is

203:11

generate images so we have already added

203:14

the click feature on this button

203:17

generate images in the header so we have

203:19

to use the same thing in this one also

203:22

so let's come

203:24

back and uh let me just open header

203:29

again header. jsx is here so in this one

203:33

you can see we have added this and let's

203:36

copy it and we will come

203:40

to generate BTN and before this return

203:44

statement just add

203:47

this one we will get the user and set so

203:51

login from the use context app context

203:55

so we have to import this so just add

203:57

use context use context has been

204:00

imported then we will import this app

204:02

context so just add app context so app

204:06

context has been imported correct after

204:08

that we have to import this use navigate

204:11

so let me add use navigate so use

204:14

navigate has been imported corre

204:16

next we have to link this on click

204:19

Handler with the button that's it so

204:22

scroll down and here we have this button

204:25

correct so in this button where is the

204:29

button tag here so within this or let me

204:34

add it here only after this button we

204:36

will add on click and in this one we

204:40

will provide this onclick Handler

204:42

function that's it save the changes come

204:45

back to the web page

204:46

if I click here it should open the login

204:48

form but it is not visible and the

204:51

scrolling is disabled it is not visible

204:53

because the login form is at the top so

204:56

let me just come back and here we have

204:59

this login component so let's add

205:04

position

205:06

fixed save the changes and now you can

205:09

see this login form is visible if I

205:11

close it and click on this button again

205:14

again it is visible now we can aut

205:16

scroll the web page and if I close it it

205:18

is hidden correct and here also it

205:22

works it works with this login button

205:24

also

205:28

correct so we have added the animation

205:30

on this

205:32

homepage next let me just go to the

205:34

result page so just

205:37

add/ result so this is the result page

205:40

and here also we have to add the

205:41

animation so let's come back and we will

205:45

open

205:47

result. jsx

205:50

file and in this result. jsx first we

205:54

have to add the import statement to

205:56

import the motion from framer motion

206:00

like this after that here we have this

206:02

form so in this form we have to add the

206:05

animation so just

206:07

add motion.

206:10

form correct and in this motion. form we

206:15

have to add the animation properties so

206:18

here we will add the initial value

206:22

transition while in View and viewport

206:24

that we have already used in other

206:27

elements so we have added initial

206:29

opacity

206:30

100 transition duration 1 opacity 1 y 0

206:35

VIP put one's true so we have added the

206:37

animation for this one also after that

206:41

we have to add the animation

206:44

in credit page so let me click here so

206:48

it will open this credit page right so

206:51

in this one we have to add

206:54

the animation so let's come

206:58

back we will open by credit. jsx file

207:01

and here also we will add the import

207:03

statement so first we have to

207:07

import motion from framer motion correct

207:12

after that here we have this D

207:16

so in this div we will

207:19

add motion. div and we will add the

207:22

animation properties so we will add the

207:26

same thing initial transition while in

207:30

View and view

207:31

Port save the changes let's come

207:35

back now you can see this page is also

207:39

animated next we have to add the

207:42

animation in the login form for that

207:44

just come back and and we will open

207:47

login. jsx

207:49

file and in this one we have to add the

207:52

import statement first so here we will

207:55

add import

207:57

motion from framer motion correct after

208:02

that I scroll down and here you can see

208:06

we have this form tag correct so in this

208:10

form let's

208:12

add motion.

208:14

form then we will add add the animation

208:17

properties so here also we will add the

208:19

same thing but we will change the values

208:22

so just add initial transition while in

208:26

view viewport and here we will add the

208:28

duration of 3 and opacity is2 y50 and y0

208:35

correct save the changes and come back

208:37

to the web

208:39

page now if I open this

208:41

login form you can see this login form

208:45

comes with smooth animation let me close

208:47

it and click on this login button again

208:51

you can see the animation let me go to

208:53

home

208:54

page click on this button you can see

208:58

this login form comes with smooth

209:00

animation so now we have added the

209:02

animation also on our website so now we

209:06

have completed the front end part of our

209:10

application next we will add the back

209:13

end and using the back end we will add

209:15

the functional to login and register

209:18

users on this application and we will

209:20

also add the functionality to generate

209:22

the images using

209:25

AI so let's come back to the vs code

209:28

editor and here we have the left side

209:31

bar where you can see the client folder

209:32

let me collapse it and here let's right

209:36

click and select new folder and here in

209:40

this one we will create a folder called

209:44

server so now in this image F folder

209:46

that is our project folder here we have

209:49

a client folder and server folder and in

209:52

This Server folder we will create the

209:54

backend server of our

209:57

application now right click on this

210:00

server folder and select open in

210:02

integrated

210:05

terminal so in this terminal you can see

210:08

we are at server folder correct now here

210:12

in the left side bar in This Server

210:14

folder we will create a file so right

210:16

click and select new file and write the

210:19

file name

210:24

server.js so we have created this

210:26

server.js file after that in this

210:29

terminal let's add npm in

210:34

it then press

210:37

enter now it is asking for the package

210:40

name so the package name will be folder

210:42

name which is server so just press enter

210:45

nothing else

210:47

after that keep on pressing

210:51

enter the entry point will be

210:54

server.js by default it is added simply

210:57

press

210:58

enter again

211:02

enter now you can see in the left

211:04

sidebar in This Server folder we have a

211:07

file called package.json so in this

211:10

package.json you can see we have a

211:15

script

211:16

start node server.js and here we have

211:20

test script so let me just remove this

211:23

test script from here so whenever we

211:26

will type npm run a start in the

211:29

terminal then it will execute this node

211:34

server.js correct now in this one we are

211:37

going to use the import statement so

211:41

here we have to add the type

211:44

so in this one let's add double quote

211:50

type and here we will add type is equal

211:53

to

211:55

module like this save the changes and

211:59

after that let's come to this terminal

212:01

again and in this terminal we have to

212:04

install some packages for our backend

212:07

server so in the back end we will create

212:10

the app using Express package so let's

212:14

add npm

212:17

hi that is for install and here we will

212:19

install multiple packages so the first

212:22

one is

212:25

Express then we will add

212:28

course that will allow us to connect the

212:31

backend server with our front end next

212:34

we will install EnV using that we can

212:39

create EnV file and use it in the

212:42

backend

212:43

server so just add Dot e and

212:47

V Next we will install node modon

212:52

package using this package it will

212:55

restart the backend server whenever we

212:57

will make any changes in the code

213:00

file after that we will

213:03

add form

213:06

data then we will add Json web

213:11

token using that we will add the

213:14

authentication in our project

213:16

after that we will add

213:20

using this package we will connect

213:23

our backend server with mongod DV

213:25

database next we will add

213:29

exos it will help us to make the API

213:32

call after that we will add bcrypt

213:37

package using that we can encrypt the

213:41

password after that we will

213:44

add razor pay using this razor pay we

213:48

will add the online payment Gateway so

213:51

we have added these packages just press

213:54

enter so it will install all these

214:00

packages now all packages has been

214:02

installed let me hide this

214:06

terminal and in

214:09

the package.json file you can see here

214:12

we have the dependencies and in this one

214:14

you can see all the packages that we

214:16

have just installed

214:19

correct now just close this and

214:24

uh here in this server folder we will

214:28

create EnV file where we will store all

214:31

the secret keys and API keys so right

214:35

click on the server folder select a new

214:37

file and write the file name

214:41

EnV so in this one we will store the

214:44

secret keys

214:46

now in this server.js file we will

214:49

create a simple Express app for that

214:53

let's

214:54

add

214:56

import Express

214:59

from Express

215:01

package after that we will also import

215:05

course

215:07

from course

215:09

package we will

215:14

import do P

215:18

nv/

215:20

config after adding this UT let's add

215:23

the port number where we will run the

215:26

express app so just add

215:29

const Port equal to process.

215:35

EnV

215:37

dot Port so if the port number is

215:40

available in the environment then it

215:42

will use the port number from there or

215:45

or if it is not

215:47

available then we will use the or

215:49

operator and here we will add the port

215:52

number 4,000 after that we will add

215:56

const app and create the app

216:01

using

216:03

Express after that we have to add

216:06

the course in this Express app so here

216:10

let's

216:11

add app do use so we are using the

216:16

middle Wares in this Express app so we

216:19

are adding

216:21

app.use

216:22

course and before that we will also add

216:26

one more middleware that is Json so just

216:30

add

216:33

app.use

216:35

express.

216:38

Json so all the request will be passed

216:41

using Json method after that here we

216:44

will add

216:46

app

216:47

do get

216:49

method and here just provide the path

216:54

and here we will add one Arrow

216:58

function and in this parameter we will

217:01

take request and

217:05

response correct now here we will return

217:10

response dot

217:13

send and we will will send one message

217:16

called API

217:21

working correct so whenever we will hit

217:23

this path on the back end then it will

217:27

send this message Api working correct

217:30

next we have to start the express app

217:33

for that just add app do

217:37

listen here we have created this app so

217:40

in this one we are using app. listen and

217:43

here first we have to provide the Port

217:46

so let's add the port here after that we

217:50

will add addo

217:52

function and this Aro function will

217:56

return console.

217:59

log and here we will add one message

218:02

that will be displayed in the

218:04

terminal because we are using the

218:06

console.log in backend server so it will

218:11

display the message in terminal so here

218:14

let's add the message

218:16

server running on

218:17

Port then we will add the port

218:22

number so let's add

218:26

Plus Port that's it after adding this

218:30

save the changes so let's open the

218:33

terminal and in this terminal you can

218:35

see we are at server folder so here just

218:39

add npm run a start then press enter

218:45

now you can see this message server

218:48

running on

218:49

Port but it is not giving the port

218:51

number so let me check

218:54

it here we have to move this bracket

218:58

here after this

219:00

port correct save the changes and next

219:03

we have to stop this server using contrl

219:07

C yes and again I started using npm Run

219:12

start now you can see the message server

219:15

running on Port 4,000 correct so once

219:18

you see this message just open the web

219:22

browser and go to new tab and here we

219:26

will

219:26

type Local

219:29

Host colon

219:32

4,000 it is still loading it's not

219:35

opening so let's come back to the vs

219:40

code here we have used

219:43

app.use course so after this of course

219:45

we have to add this small bracket like

219:49

this just correct this line save the

219:52

changes and start the back end again so

219:57

crl

219:58

C yes

220:01

and again use npm Run

220:06

start server running on Port 4,000 just

220:10

come back yes it is working now you can

220:13

see on this URL Local Host colon 4,000

220:16

we are getting the message Api working

220:19

so now our simple Express app is working

220:22

at this URL so this is our backend URL

220:26

Local Host Port

220:28

4,000 correct now just come

220:32

back

220:34

and you can see whenever we make any

220:37

changes we have to stop and start the

220:40

backend server so to solve this one

220:43

let's come back to the package. Json

220:45

file and in this

220:49

one here we have one script for a start

220:52

correct so after that let's add one

220:55

comma and here we will add another

220:59

script so let's add the script name

221:03

server and here we will provide double

221:07

quote

221:09

node

221:12

server.js so it is not node here we have

221:16

to add node modon so we have already

221:20

installed the node modon package so we

221:23

can use nodon

221:26

server.js so whenever we will type npm

221:30

run server it will execute this command

221:33

nodon server.js correct so now let's

221:36

come back to the terminal and stop this

221:40

project using contrl C yes and now we

221:44

can use

221:46

npm

221:48

run

221:50

server we have added npm run server and

221:54

press

221:57

enter so again you can see the same

221:59

message server running on Port 4,000 and

222:02

if I come back to the browser this

222:04

backend server is working we are getting

222:07

the message Api working correct now if I

222:10

come back to

222:11

the server.js file and and if I make any

222:16

changes here

222:17

so instead of API working let's add API

222:23

working

222:25

fine so we have updated this message Api

222:28

working fine now you can see this

222:30

changes will reflect on the backend

222:33

server so just come back and you can see

222:36

if I refresh it we are getting API

222:38

working fine so we don't have to restart

222:41

the backend server when we are using

222:44

nodemon

222:45

correct so let's come back and make it

222:48

API working

222:49

only now we have to connect our project

222:52

with mongod DV so that we can store the

222:56

users data in the database for that we

222:59

have to create a mongod DB Atlas account

223:03

so let's open browser open a new tab and

223:07

search

223:08

for

223:11

mongodb or we will search for mongodb

223:16

Atlas correct now open this

223:20

website here just click on sign

223:24

in and here you have to create an

223:27

account you can click on this sign up

223:29

button and create your account using

223:31

email ID or you can also use the Google

223:35

account so I'll use the Google account

223:36

to sign in in my existing account

223:45

on this mongod DB Atlas just click on

223:48

create a

223:50

cluster here we have to choose

223:53

the server so I'm going to use this m0

223:57

that is a free server correct so we are

224:00

using this free

224:02

version here it is giving cluster zero

224:06

so let's keep it default so we have

224:10

three options AWS Google Cloud Aur so

224:13

let's select Google Cloud

224:16

here you have to select the nearest

224:18

reason so I'll select Mumbai now just

224:21

click on this create deployment

224:27

button now it is giving the username and

224:31

here we can create the password for our

224:33

database so the username is greatest tag

224:37

I will keep the username greatest Tack

224:39

and in the password I will

224:43

type greatest tack 1 2 3 never use at

224:47

theate symbol in this

224:49

password after that just click on

224:52

this create database

224:55

user now just click on this button

224:59

choose a connection

225:00

method here we will select this

225:04

Compass now select this option I have

225:07

mongod DB Compass installed just click

225:10

here here is taking some time so just

225:13

wait for 10 to 15 seconds

225:17

now it is displaying the mongodb

225:20

connection URL so let me just copy

225:24

it just click here to copy so here we

225:27

have the username and here we have the

225:29

password if you toggle this option so it

225:32

will display the password like this so

225:34

instead of this you have to provide your

225:37

password so let me just enable my

225:39

password and copy this string that's it

225:43

now click on this button done

225:45

and come back to the vs

225:48

code in this one just open EnV file and

225:52

in this one we will store the mongod DB

225:54

connection URI so here let's

225:58

add envirment

226:03

variable mongod DV UI and in the double

226:08

quote paste this string now at the end

226:12

you can see here we have forward slash

226:14

so remove this forward slash from here

226:17

correct so you can see we have added

226:19

this complete

226:21

URL like this in the double quote we

226:24

don't have the forward slash at the end

226:26

and here we have the username of our

226:28

database and this is the password that

226:31

we have created for the

226:33

database that's it save the changes now

226:37

just come back to the mongod DB Atlas

226:39

again and here we have to add the IP

226:42

address so let's come here and in

226:45

this network access in the left side bar

226:49

just click

226:51

here and in this one you can see it is

226:53

displaying my current IP address so let

226:57

me just delete it and here we will click

227:01

on ADD IP

227:03

address and click on this button allow

227:06

access from anywhere just click here so

227:09

it will add this entry

227:11

0.0.0.0 now just click on confirm button

227:16

so now you can see this

227:19

000000 IP has been added so that we can

227:22

connect our mongod DV database from any

227:26

IP address so you can see the status is

227:29

pending now it is active so now we can

227:32

connect the mongod DV Atlas database

227:34

with our Express app so let's close it

227:39

and come back to the vs

227:41

code and here in the left side bar we

227:44

have the server folder so in this folder

227:47

we will create a new folder called

227:52

config in this config folder let's

227:55

create a new file so write the file name

227:58

mongod db.

228:02

JS so here we will add the code to

228:05

connect the project with mongod DB

228:08

database so first we have to import

228:10

so just add

228:13

import from Mongo's package

228:17

correct after that we will create one

228:20

function

228:23

const connect DB that is connect

228:26

database it will be one async function

228:29

so just add asnc and add a

228:34

function now in this one we have to add

228:38

await do

228:43

connect and in this one we have to

228:45

provide our mongod DB connection URI so

228:49

we have already stored this mongodb

228:52

connection u in the envirment variable

228:55

so we will get it from the envirment

228:57

variable so here just add back Tex so we

229:00

can use the template literal so in this

229:03

one we have added the back Tex then

229:05

dollar sign and cly

229:08

bres and in this one we will add process

229:12

do EnV

229:15

dot involvement variable name that is

229:18

this one mongod dvore URI so just place

229:22

it

229:23

here correct now after this URI we have

229:27

to provide the database name so our

229:31

project name is imagify so after this

229:34

curly veres simply add forward slash

229:38

then write the project

229:42

name imagify

229:45

let me expand it so you can see in one

229:47

line we have

229:49

added doc connect and provided the

229:52

connection URL and at the end we have

229:54

provided slash and project name

229:58

imagy that's it now here we have to add

230:01

one event also so before this line let's

230:04

add

230:06

one event mongus

230:11

dot connection Dot

230:16

on so it will get the connection event

230:20

so here just

230:23

add connected so whenever the database

230:26

will be connected then this function

230:29

will be

230:30

executed so in this function we will

230:33

display one message so just add

230:36

console. log and here let's print one

230:40

message called database connected

230:44

correct so what will happen whenever the

230:47

database will be connected then this

230:50

event will be executed and whenever this

230:52

event will be occurred then this

230:54

function will be executed and it will

230:57

display this message database connected

230:59

in the terminal next we have to export

231:03

this connect DB function so that we can

231:05

use it in the other files so just add

231:11

export

231:12

default and function name connect DB

231:17

that's it now we can use this function

231:19

in server.js file so let's open

231:21

server.js file and here we have to

231:26

import that so here let's

231:29

add

231:31

import connect DV from single code. SL

231:38

config SL mongod dev. JS we have to

231:44

write the complete path with file name

231:47

extension mongod db. JS correct now we

231:52

have this connect DV function here in

231:54

this server.js file so just we have to

231:56

call this function so we will call it

232:01

here after this app.use just add

232:06

await and call this function connect DV

232:11

so it will connect our Express app with

232:14

the the mongod DV

232:18

database that's

232:20

it now if I come back to the

232:24

terminal so let me open the

232:27

terminal and now you can see in this

232:30

terminal we are getting the message

232:32

database connected and after that we are

232:34

getting the message server running on

232:36

Port 4,000 so it says our Express app is

232:41

connected with the

232:43

database so after connecting our project

232:46

with the database next we have to create

232:49

the schema and models for the DB

232:52

database so that we can store the users

232:55

information and other information on the

232:57

mongod DB

232:59

database for that here in the left side

233:03

bar we will create one folder called

233:06

Model So In This Server folder right

233:10

click and select new

233:13

folder and the folder name will be

233:17

models so using this models we will

233:20

store the data in the mongod DV database

233:23

so we have to store two types of data so

233:26

the first one will be user data and the

233:29

second one will be transaction data so

233:32

first let's create the models for user

233:35

data so in this models folder create a

233:38

new file with the name user model. Js

233:45

now in this user model. JS let's

233:49

add

233:52

import from

233:56

package now we have to create the user a

233:59

schema so just add

234:02

const user

234:06

schema equal to

234:10

new do

234:13

schema now in this one we have to define

234:16

the structure of our data that we will

234:18

store in the database so first we will

234:21

store the user name then we will store

234:23

the email password and we will also

234:25

store the credit balance for the users

234:29

so let's add

234:30

name and for this name let's provide

234:33

some properties so here we will provide

234:36

the type so for this data we will

234:39

provide the

234:41

type and the type will be string

234:45

now this data will be required to save

234:48

the data in the database so just add

234:52

required

234:56

true

234:58

correct now just add the comma and here

235:01

we will add the second data that is

235:04

email this will be the users's

235:08

email here we will add the type that is

235:11

a string and it is also required

235:16

like this and this email should be

235:18

unique so here we will add one more

235:21

property

235:23

unique and it will be

235:26

true so we cannot store any new user

235:29

with the same email

235:31

ID after that we have to store the

235:33

password so let's add

235:37

password and here we will add the same

235:41

thing type is equal to a string

235:44

and required true correct and after that

235:50

we will store the credit balance so

235:53

let's add the property createit balance

235:56

and the type will be number and the

235:59

default value will be

236:01

five correct so now we have created the

236:05

schema Now using this schema we will

236:08

create the user model so here just add

236:13

const

236:15

user

236:16

model equal to do

236:22

model and here we have to provide the

236:24

model name that will be

236:26

user then we have to provide the schema

236:30

that is user schema so using this schema

236:33

it will create a model with the name

236:35

user correct now what will happen it

236:38

will try to create the user model again

236:41

and again right so to solve this one

236:45

here let's add do

236:49

models right and here we will provide

236:53

dot

236:54

user then we will add the r

236:57

operator so what will happen first it

236:59

will search for the existing models

237:02

where the name is user right so if the

237:05

user model is already available then it

237:08

will use that user model if it is not

237:11

available then it will create the new

237:14

user model using this schema let me add

237:16

the spelling here user model correct

237:21

next we have to export this user model

237:23

so that we can use in any other file so

237:27

let's add

237:30

export

237:32

default user

237:34

model correct Now using this user model

237:37

we will create different apis and using

237:39

that user can create an account user can

237:42

login into existing account account and

237:44

user can log out from the account so

237:48

let's open this sidebar and here in this

237:50

server folder we will create a new

237:52

folder called

237:59

controllers in this controllers folder

238:01

we will create a new file called user

238:09

controller.js where we will create

238:11

different controller function for

238:15

user registration user login and user

238:18

log out so first we'll create the

238:21

controller function for registration for

238:24

that we need the user model so first

238:26

we'll import user model from user model.

238:31

JS file just write the file name

238:34

extension

238:36

also after that we have to

238:39

import

238:40

the

238:42

bcrypt so using the bcrypt we will

238:45

encrypt the password so just add

238:50

import bcrypt from

238:53

bcrypt correct after that we will add

238:57

the

238:58

import and we will import

239:02

JWT from Json web

239:07

token and using this JWT we will create

239:10

a token for user Authentication

239:15

so after adding this here let's add

239:20

const and we will add a controller

239:25

function so just add the function name

239:27

register

239:28

user now we will create one asynchronous

239:32

function so just add

239:34

async and create the arrow

239:37

function and in this parameter we will

239:39

take

239:41

request and response

239:46

correct now we will add the TR catch

239:48

block now in this try block we will find

239:52

the name email ID and password right so

239:55

to create an account we need the users's

239:58

name email ID and password and we will

240:01

get all these information from the

240:03

request body correct so just add

240:06

const

240:08

name email and password

240:15

then we will add request dot

240:21

body so from request body we will find

240:24

the name email and password next we will

240:27

check whether the name email and

240:29

password is available or not so just add

240:33

if and we will add not name it means the

240:37

name is not available

240:39

or not of

240:41

email so if the email is not available

240:45

or we will add not of

240:48

password so if the password is not

240:51

provided in any of this condition what

240:53

will happen we will return one response

240:56

so just add

240:59

return response and we will send the

241:03

response using

241:06

Json and here just add one object with

241:11

the success property false

241:16

then we will add the message also so

241:18

just add

241:20

message and here we will add the message

241:23

called missing details either email is

241:27

missing or name is missing or password

241:30

is

241:31

missing so if any of this is missing

241:34

then it will return this response with

241:37

success fails and the message is missing

241:39

details right now if all three things

241:44

are available then we will proceed for

241:46

the next step so the next step is to

241:49

encrypt the password that is given by

241:52

the user so here just add const and here

241:56

we will add one

241:58

salt is equal to

242:01

await and here we will add

242:05

bcrypt dot gen

242:09

salt here we will use 10 so it will add

242:13

the moderate encryption if we'll

242:15

increase the value it will be more

242:18

secure password but it will take more

242:20

time also so after that we will

242:24

add

242:26

const and here we will get the encrypted

242:30

password or hased password so just

242:33

add hased

242:36

password equal to

242:40

await bcrypt do has

242:46

and we will has the password that user

242:49

has provided in the body so just add the

242:53

original password then we will provide

242:55

the salt so with this password and salt

242:59

we will get one hased password correct

243:02

now we can store this has password in

243:05

the database correct so next we have to

243:08

create

243:10

one object where we will store all the

243:12

users data that will be stored in the

243:15

database so just add

243:17

const and we will add the user

243:21

data equal to one object so in this one

243:26

we will store the name that is available

243:29

in the body then we will store the email

243:32

it is also available in the body then we

243:34

will add password and in this password

243:39

we have to store the encrypted password

243:42

or hashed password

243:44

like

243:45

this correct so we have added three

243:49

properties name email and password so

243:52

now we have the user data next we have

243:54

to save this user data in the mongod DV

243:57

database so here let's add

244:00

const new

244:03

user is equal to

244:06

new user

244:08

model and in this user model we will

244:11

provide this data

244:14

correct so as you can see in this user

244:17

model we have added name email and

244:20

password then createit balance so we are

244:23

providing the name email and password

244:25

only because for this creit balance we

244:28

have already added the default value

244:30

five so let's come back to this page you

244:33

can see we are storing this data name

244:36

email and password and the by default

244:39

the credit Balance 5 will be added in

244:42

this new user

244:44

correct now we have the new user just

244:47

save this user in the database so just

244:50

add const user is equal to

244:54

await new user do save

244:59

method that's it so it will save a new

245:02

user in the database and we will get

245:05

that user here in this variable correct

245:09

now we will generate one token that will

245:11

be sent in the response so that we can

245:14

enable the login and registration in the

245:18

front end so here let's add

245:22

const token to generate this token we

245:25

will use JWT that is Json web token so

245:29

just add JWT we have already imported it

245:33

here right now here just add JWT do

245:40

sign and here we have to add the ID so

245:46

let's add ID and we will get the ID from

245:49

this user so whenever the user will be

245:51

created in the database it will

245:53

automatically generate one ID with the

245:56

property underscore ID so here let's

246:00

add user

246:03

doore ID that is autogenerated in the

246:07

mongod DV database so the ID will be

246:10

unique so using this unique data we will

246:12

generate one token and with this ID we

246:16

need one more thing so this will be

246:20

the

246:21

first argument and here we will add one

246:25

more so just add comma and here we have

246:29

to provide one secret key so we will

246:33

declare this secret key in the

246:34

environment variable so let me just come

246:36

back to the EnV file and here let's

246:41

add JW T secret equal to and uh here let

246:48

me add secret has text you can add

246:53

anything that's it now just come back

246:57

and here we will use that secret from

247:01

the EnV file so in this one we will add

247:06

process. EnV Dot and the variable name

247:11

that is JWT Secret place it

247:15

here like this so now we have this token

247:19

correct next we have to send this token

247:21

in the response so till now what

247:24

happened we have created a user data

247:27

from the response and in this user data

247:30

we have stored the encrypted password

247:32

now using this data we have created a

247:35

new user in the database correct now in

247:38

the database for this user one unique ID

247:41

will be generated so you using that

247:43

unique ID and our secret string we have

247:47

generated one token using this JWT sign

247:50

method now we will send this token in

247:52

the response so just add response.

247:57

Json and here we will send one object so

248:02

here let's add one success property that

248:05

is

248:06

true correct after that we will send

248:09

this token

248:11

also right now we will send

248:14

the user and in this user property we

248:18

will add the name only so let's add

248:25

name is equal

248:27

to user do

248:30

name so in the response we are sending

248:33

the Success Through then token and then

248:36

we are providing the user object and in

248:40

this user object there will be one

248:41

property called name

248:44

right now if any error occurs in the tri

248:47

block then this catch block will be

248:50

executed so in this catch block let's

248:52

add console log. error so it will

248:57

display the error message in the backend

249:00

terminal after that we will generate the

249:03

response also so just add response dot

249:07

Json and here also we will add one

249:10

object and in this object we have to add

249:13

SU Su and the success will be

249:17

false correct then we will add the

249:19

message also so let's add the

249:22

message and in this message let's add

249:26

this

249:27

error error do message from this error

249:32

object it will find the error

249:34

message that's it so now we have created

249:37

one registered user controller function

249:41

after creating this user

249:44

controller function next we will create

249:46

the user login controller function so

249:49

let's scroll

249:51

down and here let's add const login

249:57

user and it is also one asnc function so

250:01

just add as

250:03

sync and create the arrow

250:06

function here also we will add request

250:09

and

250:11

response now in this one just add the TR

250:14

catch

250:17

block now in this Tri block we will find

250:20

the email ID and password from the

250:23

request body because for user login we

250:26

need only email ID and password so let's

250:29

add

250:30

const email and

250:33

password and we will get it from

250:39

request do

250:41

body correct

250:44

now we have to find the user using this

250:48

email ID because the email ID is unique

250:50

so here let's add

250:53

const and user equal to

250:59

await to find the user we are going to

251:02

use the user model you can see we have

251:04

created the user model so using this

251:06

user model we have created user in the

251:09

database and to find the user we have to

251:11

use this user model only so here let's

251:14

add

251:16

await user model

251:20

dot find one method and in this one we

251:23

will provide

251:24

the email right so it will find the user

251:30

with this email ID provided by the user

251:33

from the request body correct so now we

251:37

will check if the user is available with

251:40

this email ID or not so let's add the if

251:44

condition and we will type not of user

251:48

so if the user is not available with

251:50

this email ID then what will happen we

251:52

will generate one response with success

251:55

Falls so here just

251:58

add

251:59

return

252:01

response and let me just copy the

252:04

response message from

252:06

here this one and paste it

252:10

here so return response success false

252:14

and in the message we will type user

252:17

does not

252:20

exist correct so if the user is not

252:23

available then we will return the

252:25

response with message user does not

252:28

exist suppose the user is available so

252:31

let's proceed for the next step so the

252:33

next step is to match the password so

252:37

here just add

252:39

const is match

252:43

is equal

252:45

to

252:47

await and here we will use

252:51

bcrypt and in this one we will

252:54

add compare

252:57

method so this bcrypt do compared will

253:00

compare the saved password and the

253:03

password provided by the request so just

253:06

add the password that is provided in the

253:08

request and here we will compare it with

253:11

the password say saved in the database

253:15

for this user so let's add

253:18

user do

253:21

password so if the password is matching

253:24

then this is match will be true if it is

253:26

not matching then it will be false so

253:29

here let's check

253:32

if AG match is

253:37

true then we will generate one message

253:39

with the success true and if it is is

253:43

not matching then we will add else

253:45

condition and here we will generate one

253:47

response with success false so let me

253:49

add this statement here return response

253:53

success false and in the message we will

253:56

type invalid

253:59

credentials like this and if it is

254:02

matching then here what will happen here

254:06

we have to generate one token and we

254:08

will send this token in the response so

254:11

to generate the token here we have

254:13

already used this sign method so just

254:17

copy

254:18

this and copy this one

254:21

also and here in this if statement let's

254:25

add cost token is equal to JWT do sign

254:30

ID is equal to user do ID right then

254:35

we'll add process do

254:38

env. JWT secret so it will generate the

254:42

token using the ID stored in the user

254:48

right so after generating the token it

254:50

will send the response so here we have

254:52

added response. Json and the success

254:57

will be true then we will send the token

255:00

and with this token we will send the

255:02

user's name also so we have sent the

255:05

user object and in this object we have

255:07

sent the name with the user.name

255:13

right so now we have created the

255:15

controller function but here we have the

255:18

catch block also so if any error occurs

255:21

in the tri block then the catch block

255:23

will be executed so just copy the

255:26

statement from the previous catch block

255:29

and paste it

255:31

here console.log error response. Json

255:35

success false and the message is error.

255:39

message so now we have created the

255:42

controller function for user login and

255:45

user

255:46

registration after that we have to

255:48

create the API so here in the left side

255:52

bar in This Server folder create a new

255:55

folder with the name

256:00

routes now in this routes folder we will

256:03

create a new file so right click and

256:06

select new file and the file name will

256:08

be user route

256:13

user

256:14

routes.js

256:16

now in this user routes.js we need that

256:20

controller function so let's add

256:24

import register user

256:27

and login user and we will import it

256:31

from double

256:34

do/ controllers

256:36

folder and user

256:40

controller.js file

256:43

correct so we have imported the

256:46

controller function that is register

256:48

user and login user and before that we

256:51

have to

256:53

import

256:56

Express from

257:00

Express correct now we have to create

257:03

the router so we will add

257:07

const user

257:09

router equal to express

257:14

dot

257:16

router correct now in this user router

257:20

we have to create the

257:22

endpoint and we have to provide the

257:25

controller function at that endpoint so

257:27

let's add user router dot post we will

257:33

use the post method and here we have to

257:36

provide the endpoint path it will be

257:41

registered like this and at this path it

257:45

will execute the controller function

257:47

that is registered user correct now just

257:50

duplicate it here also we will use user

257:53

router. poost method and it will be

257:57

login and here we will

258:00

use here we will use login user

258:04

controller function right after that we

258:06

have to export this router so at the end

258:10

we will add export

258:14

default and provide this user router

258:17

correct now we will add this user router

258:20

in our Express app so let's open

258:23

server.js file and in this one here

258:28

before this one let's add app.

258:33

use and here we have to add the path so

258:38

we will add SL API slash

258:42

user and at this path we will add the

258:45

router that is user router so we will

258:49

select it from the suggestion so this

258:52

user router has been

258:55

imported so we have added app.use API /

258:59

user and user

259:00

router after adding this what happens

259:03

whenever we will type the backend Ur

259:07

that is the Local Host Port 4000 then /

259:11

API / user and slash this register then

259:16

it will hit the register API endpoint

259:20

let me write it

259:22

here like

259:24

this Local Host colon

259:29

4,000 then slash this one/ API SL

259:36

user and after that we'll add

259:39

SL

259:41

register so whenever we will hit this

259:44

end point then it will execute this

259:47

registered user controller function and

259:49

whenever we will hit the another

259:51

endpoint that is this one login then it

259:55

will hit this endpoint and it will

259:58

execute this login user controller

260:01

function that will allow us to login

260:04

right so now we will test these

260:07

API so to test it we need one tool

260:11

called Postman so let's open web

260:14

browser and here we will search for

260:17

Postman

260:22

download open this link post man.com

260:30

downloads click here to download this

260:34

one after downloading just execute this

260:39

setup

260:40

file after that it is asking for the

260:44

sign up so let me sign up using my

260:46

Google

260:54

account now we are at the postman tool

260:58

let me change the appearance so I'll

261:00

click on this gear icon or settings icon

261:03

then select settings from here I'll

261:06

select themes here it is showing the day

261:10

theme is active so let me click on this

261:12

button manual now select this

261:16

dark that's it close this popup now we

261:20

will create the collection so just click

261:21

on this plus icon so it will create a

261:24

new

261:25

collection and here we will use this

261:27

rest API

261:29

basic now click on this plus icon and

261:32

select blank

261:34

collection now just click on this

261:37

button here we will add the name imagify

261:43

now click on this link add a

261:46

request here in this field we have to

261:49

add the endpoint URL so you can see we

261:51

have already added it here so let me

261:54

just copy this register

261:57

endpoint and we will past it

262:01

here

262:03

HTTP Local Host 4,000 SL API SL

262:07

userregister and here we have to select

262:10

the method so the method will be post

262:13

correct now in this body we have to send

262:17

the name email ID and

262:21

password so in this body let me select

262:24

this

262:24

raw and here we will add one object and

262:29

here let's add name greatest

262:33

tag then we will add the

262:38

email greatest td@ gmail.com

262:43

then we will add the

262:47

password and in the password let me add

262:50

one 2 3 4 5

262:52

6 here we have to add it in a

263:02

string right after that just click on

263:04

this send button so here it is giving

263:08

some error right so let me just come

263:11

back to the vs code open the terminal

263:14

and in this terminal we are getting some

263:17

error user controller.js file does not

263:20

provide an export

263:22

named login user so let me check that we

263:26

will go to user

263:31

controller and uh scroll down yes we

263:35

have to export this one you can see we

263:38

have added user registered right and

263:43

this login user so we have to export it

263:47

from here so just add

263:50

export curly presses and we will add

263:53

register user and login user now we have

263:57

exported this controller function from

264:00

here after that just come back

264:02

again and click on the send

264:07

button now you can see we are getting

264:09

the status 200 okay right and in this

264:13

response we are getting success true

264:16

then we are getting the token and here

264:18

we have the

264:20

user and the username is greatest

264:23

tag correct so let me verify it with the

264:27

database also so if I come back to the

264:29

web browser and come to this mongodb

264:33

Atlas then click on this

264:38

clusters now click on this browse

264:41

collections

264:45

so in this one you can see we have one

264:46

database with the name imagify that is

264:48

our project name and in this imagify we

264:51

have the users collection so in this

264:54

users collection we have one entry you

264:56

can see we have one user called greatest

264:59

tack the email ID is greatest tack D at

265:01

Gmail and this is the encrypted password

265:04

and you can see the credit balance has

265:07

been added that is five so we have added

265:11

the default value for the credit balance

265:14

so this user registration API is working

265:18

fine right now let's test the user login

265:23

API so just come back and come to this

265:28

Postman and from here let me remove this

265:32

register and instead of that we'll add

265:34

login that is the

265:37

endpoint so we have added / API SL user

265:40

/ login and in this body we have to send

265:44

only email ID and password so remove

265:46

this name property and we are sending

265:49

the email ID and password so first let

265:52

me add the different email ID so I'll

265:55

add greatest tack Dev 1@gmail.com and

265:59

click on the send

266:01

button now you can see the response it

266:03

is giving false success is false and the

266:07

message is rest is not a function so

266:11

let's see the login API come back here

266:17

user controller and uh this login

266:20

controller function so in this one we

266:23

have used res right so here instead of

266:27

this res we will add rest do Json it

266:30

means response. Json and let's check

266:34

other code also here also we will add

266:39

response.

266:40

Json now it is correct correct let me

266:43

check the previous

266:46

code it is correct here we have used

266:48

response. Json now everything is correct

266:53

now just come back and again click on

266:54

the send

266:56

button and this time you are getting the

266:58

correct message that is user does not

267:01

exist in this response because we have

267:04

added the incorrect email ID now if I

267:07

provide the correct email ID like

267:09

greatest T Dev at gmail

267:12

that is the correct email

267:15

ID and now we will add the incorrect

267:18

password like this 1 2 3 4 5 6 7 8 that

267:23

is the incorrect password and click on

267:25

this send

267:26

button now you can see the message

267:28

success fals and the message is invalid

267:32

credentials because we have provided the

267:34

incorrect password now what happens when

267:37

we provide the correct password so here

267:40

let's provide the correct password 1 2 3

267:43

4 5 6 and click on this send

267:46

button now you can see we are getting

267:48

success true and it is generating the

267:51

token so we are getting the token also

267:53

in the response and we are getting the

267:55

name greatest tack correct so this login

267:59

and registration API is successfully

268:03

working next we have to create the API

268:06

for the user credit so let's come back

268:09

to the vs code editor

268:12

to create the user credit API first we

268:16

have to create the controller function

268:18

so in this file user

268:20

controller.js after this controller

268:22

function which is login

268:25

user here we will add a new controller

268:29

function so just add const and the

268:32

function name is user credits and it

268:36

will be asynchronous Aro function so

268:38

just add async and create the Aro

268:40

function

268:43

in this parameter we will take request

268:47

and

268:48

response and within this function first

268:51

we will add the try catch block now we

268:56

need the user ID to get the credit of

268:59

the particular user so we will add

269:03

const user

269:05

ID we will add it in curly

269:08

Braes equal

269:10

to request

269:12

do

269:14

body so here we have added the user ID

269:18

that we will get from request. body but

269:22

we will not send the user ID from the

269:24

body instead of that we will add one

269:26

middle Weare that will find the user ID

269:29

from the token and that will add the

269:32

user ID in the body so we have to create

269:35

that middleware

269:37

also so let me complete this controller

269:40

function first then we'll create the

269:41

middle whereare so here we have to find

269:45

the user using this user ID so we will

269:48

add

269:50

con user equal

269:53

to

269:56

await and we will find the user from

269:59

user model so just add user model dot

270:03

find by

270:05

ID and in this one we have to provide

270:08

this user ID correct so after getting

270:11

the user data next we will return one

270:15

response so just

270:17

add response dot

270:20

Json and here we will return one object

270:25

so in this object we will add the

270:26

success property that will be

270:29

true and after that we will add credit

270:34

so let's

270:36

add credits and in this credits property

270:40

let's add the this

270:42

user and here we will add

270:46

Dot credit balance in this user model

270:51

you can see we have added the property

270:53

called credit balance so we will add it

270:56

here user do credit

270:58

balance so in this response we will also

271:02

send the user's name so we will add

271:05

user and it will be one object and in

271:08

this object we will add the name and the

271:11

name will be be user.name

271:15

so in this response we will get the

271:17

user's name success true and we will get

271:19

the users

271:21

credits if any error occurs in this triy

271:24

block then the catch block will be

271:26

executed so let me add the same

271:29

statement in this cetch block also so we

271:32

will add console log error. message and

271:36

response. Json success fals and message

271:41

error do

271:43

message so we have added the controller

271:46

function for user

271:48

credits now in this user credits we need

271:52

the user ID in the body right and we

271:57

will provide the user ID in the body

271:58

using the middleware so in the left side

272:02

bar in This Server folder let's create a

272:07

folder called middle Wares

272:14

in this middleware folder we will create

272:16

a new file and the file name is

272:22

.js in this .js file we have to find the

272:28

user ID using the Json web token so

272:33

first we will import

272:37

JWT and we will import it from Json web

272:41

token right after that we'll create the

272:44

middleware function so we'll add

272:47

const user

272:50

o as sync and in this one we will get

272:56

request

272:58

response and after that we will add the

273:02

next so whenever the success will be

273:05

true then we will call the next method

273:08

that will execute the control

273:12

function so this middle we will be

273:15

executed before the controller function

273:18

whenever we will hit the API so in this

273:21

one we have to find

273:23

the token so first let's create this add

273:29

function and in this AR function we have

273:32

to find the token so we will add

273:36

const

273:39

token equal to

273:42

request dot

273:46

headers so in the header the token will

273:49

be added and we will find the token in

273:52

this middleware now from this token we

273:55

have to find the users's ID so here we

273:58

will

273:59

check if this token is not available so

274:03

we will add not of

274:05

token so in that case what will happen

274:08

we will generate one response so let's

274:11

right return response. Json success

274:15

Falls and the message will be not

274:18

authorized login again because the token

274:21

is not available right but if the token

274:24

is available then we will go for the

274:26

next step so here let's add the TR catch

274:30

block now in this Tri block we will

274:35

add

274:37

const and we will add the token decode

274:45

equal to

274:47

JWT do

274:50

verify and in this one we have to

274:52

provide this token that we are getting

274:54

from the headers and we will verify it

274:58

using the secret key that we have stored

275:01

in the involment variable to get that

275:03

secret key from the involment variable

275:05

we will add

275:07

process.

275:08

EnV do JW T

275:15

secret correct so now we have the

275:18

decoded token and in this decoded token

275:21

there will be one ID because we have

275:23

created the token using the ID right so

275:26

from this decoded token we will find the

275:29

ID and here we will add if token

275:34

decode do ID if this ID is available

275:39

then we will attach this ID in the

275:42

request

275:43

body with the user ID property so we

275:47

will add request do body and in this

275:52

body we will add one property called

275:55

user

275:56

ID and in this user ID we will provide

275:59

this decode do ID that's it so the user

276:05

ID will be added in request

276:07

body and here we will add the else

276:10

condition also suppose this ID is not

276:14

available now in this Elsa statement we

276:17

have to return one response so let me

276:21

add return response. Json success Falls

276:25

and the message is not authorized login

276:28

again suppose this ID is not available

276:31

then we will get the response success

276:34

fails and the message is not authorized

276:36

login

276:37

again and after that we have to call the

276:40

next method

276:42

so this next method will execute the

276:46

controller function that will return the

276:48

users's credit now if any error occurs

276:51

in the tri block then the catch block

276:53

will be executed so in this catch block

276:56

let me add

276:57

the response so just add response. Json

277:01

success false and the message is error.

277:04

message that's it so now we have created

277:07

the user o middleware that will find the

277:10

user ID from the token and it will add

277:12

that user ID in the request body so

277:16

after that we have to export this user o

277:20

middleware so just add

277:24

export

277:27

default user or after creating this

277:30

middleware let me just come back to the

277:32

user controller.js file again and here

277:35

we have created this user credits so we

277:39

have to export this one also so we will

277:41

add the comma and user credits so we

277:44

have exported this user credits

277:45

controller function next we have to

277:47

create the API endpoint so from the left

277:51

side bar let's open user routes.js

277:56

and in this one we will create one more

277:59

route so let me just duplicate this

278:02

line and in this one we will provide the

278:05

path so inste of this login let me add

278:09

credits

278:12

and here we have added

278:14

this login user controller function so

278:17

instead of that we will add user credits

278:21

controller function so user credits

278:24

controller function has been imported

278:26

here correct after adding this we can

278:29

hit the URL that is/ API SL user SL

278:35

credits then it will return the users

278:39

credit so now we have created this end

278:42

point and in this one we have added user

278:45

credits controller function but to

278:48

execute this user credits controller

278:50

function we need the user ID and to get

278:53

the user ID we need the middleware so

278:57

here before this one we have to add the

278:59

middle Weare so let's add comma and we

279:03

will

279:04

add user or so the user or has been

279:08

imported from this middle wees

279:12

.js file so we have imported this

279:14

middleware and added this middleware in

279:17

this endp point that is/ credits that's

279:20

it save the changes now we can test this

279:23

API end point that will return the

279:25

users's credit so to test it we will

279:28

come back to the postman

279:31

again and in this one we will create a

279:33

new request so just click on this plus

279:36

icon and here we have to select the post

279:39

method and in this one we have to

279:41

provide the

279:42

URL and it will be/ API SL user SL

279:48

credits and if I simply click on this

279:51

send button now we are getting the

279:54

message not authorized login again

279:57

because we have not provided the token

280:01

now let's provide the token in the

280:03

headers so from this request let me just

280:07

copy this

280:08

token this token will be generated

280:11

whenever we are logged in so just copy

280:14

this token and uh come here and in this

280:18

headers we will

280:21

add token and we will provide this value

280:26

here now again click on the send button

280:30

here we are getting the message cannot

280:32

read properties of null reading credit

280:35

balance so let me just find where is the

280:39

error if I come to user controller you

280:42

can see we are adding user ID from body

280:46

and in this

280:50

middleware we are adding this user ID in

280:52

the body but here we have added capital

280:55

D so let me make it a small D user ID

280:58

here and in this controller function

281:01

also you can see we have added the same

281:03

thing user ID with a small D save the

281:06

changes come back and now if I click on

281:10

this send button here here we have added

281:11

the

281:12

token and if I click on send button here

281:15

we are getting success true credits five

281:19

and the user object and in this user

281:22

object we have the name property and the

281:24

name is greatest tag so now we have

281:26

successfully created and tested the user

281:30

credits API that is returning the credit

281:33

balance of the particular user and to

281:36

get the credit balance we have to add

281:38

the token in the request headers after

281:41

after creating this user credits API

281:43

next we have to create the API to

281:46

generate the image using prompt so let's

281:49

come back to the vs code editor and here

281:53

we have created the controllers folder

281:55

so in this controllers folder we will

281:57

create a new file called image

282:05

controller.js now in this file we will

282:08

add One controller function so just add

282:13

const generate

282:16

image equal to a

282:20

sync and in this parameter we will take

282:25

request and

282:28

response and we will create this Aro

282:31

function we have to export this function

282:34

so simply add the export

282:37

keyword before this const correct now in

282:41

this one we will add the TR catch block

282:43

so we will add TR catch and in this

282:47

catch block we will add the statement

282:50

that will display the error message in

282:53

the console and will also return

282:56

the response so just add console.log

283:00

error. message and in the response we

283:03

will send success

283:04

fals message will be error. message

283:08

right now in this Tri block we will add

283:10

the logic to to generate the image using

283:12

prompt so in this Tri block let's add

283:18

const and cly presses here we need the

283:22

user

283:24

ID and we need the

283:29

prompt and we will get it

283:32

from request.

283:36

body so in the body we will send the

283:38

prompt but we will send the

283:41

user ID using the token and the token

283:44

will be converted into user ID using the

283:47

middleware and that will be added in

283:49

this body so we will find that user ID

283:52

and prompt in this Tri block after that

283:56

we have to find the user using this user

283:59

ID so to fetch the user we will add

284:04

const user is equal to await and we will

284:08

find the user using the user model

284:12

right we will add find by ID and just

284:18

provide this user

284:21

ID now we will check whether we have

284:23

this user or not so here let's add

284:27

if not user if the user is not available

284:32

or the prompt is not available so we'll

284:35

add not of prompt if any of this is

284:39

missing then we will return the response

284:42

so just add

284:44

return

284:45

response dot

284:49

Json and here we will send one object

284:53

with success

284:55

false and we will add the message

284:58

missing

284:59

details that's it so if the user is not

285:02

available or the prompt is not available

285:05

then we will send the response with the

285:07

success false and message is missing

285:09

details

285:11

suppose The Prompt is also available and

285:13

the user is also available then we will

285:16

check the user's

285:17

balance if the credit balance is zero or

285:20

less than zero then we will send the

285:22

response like no credit balance so we

285:25

cannot generate the image when the

285:27

balance is zero or less than that so

285:30

here we will add the if condition and in

285:33

this one we will

285:34

add user Dot credit

285:38

balance so if the user do credit balance

285:41

is equal

285:43

to0 or user

285:47

model do credit balance is less than

285:53

zero so in that case we will generate

285:56

the response so we will add

286:00

return

286:02

response.

286:04

Json and here we will send one object

286:07

with success false and we will add the

286:10

message no credit balance and with that

286:13

we will send the credit balance also so

286:16

to send the credit balance we will add

286:18

user. credit

286:20

balance that's it so if the user is not

286:24

available or prompt is not available

286:27

then this message will be sent in the

286:28

response if the balance is zero then

286:32

this message will be sent no credit

286:35

balance it will be sent in the response

286:38

if the balance is greater than Z

286:41

then we have to generate the image using

286:44

the API provided by clip drop so let me

286:48

search for clip drop on

286:51

Google so open a new tab and search for

286:55

clip

286:58

drop open this website clipd drop.

287:02

Co here you have to create an account so

287:06

let me click here and I will choose this

287:09

continue with Google option

287:11

on this clip drop website just click on

287:17

API here we have to create an account so

287:20

just click on this link sign in and here

287:23

we have to enter the email ID so let me

287:26

add the email

287:29

ID then click on this

287:32

button so it will send one email on your

287:36

email ID so let me check my email so

287:39

here we have received one email and here

287:42

we have a link sign in to clip drop API

287:46

so let's click on this

287:50

link and here we are getting the user ID

287:54

email ID and you can see the credit is

287:57

zero right but we can claim 100 free

288:01

credit so just click on this button

288:03

claim my 100 free

288:06

credits here we have to provide the name

288:08

and phone number so let me add the

288:13

name and here we will add the phone

288:19

number now just click on this claim my

288:24

credits after adding the OTP you will

288:27

get 100 free credits that is enough to

288:30

build and test this

288:32

application now we have to generate the

288:34

API key so just click on this reveal API

288:38

key button

288:41

so now the API key has been generated so

288:44

let me just copy this API key and we

288:46

will paste it in the envirment variables

288:49

so let's come back and open EnV file and

288:53

here let's

288:55

add clip drop

289:00

API and paste it in single or double

289:05

quote so we have added clip drop API in

289:09

the environment variable

289:11

after that here we will come back to the

289:15

same website and click on this

289:19

docs in this one you can see we have the

289:22

option called text to image in the left

289:25

side bar just click here and here scroll

289:29

down and you will find this URL so we

289:32

have to hit this URL to generate the

289:35

image using the prompt and in the post

289:39

method we have to send the data that is

289:42

the prompt data in this form data so to

289:46

generate the image using prompt we have

289:49

to hit this API end point this one and

289:54

we have to make the post request and in

289:57

this post request the prompt is

290:00

required right and we have to provide

290:03

this prompt in the multi-art form data

290:07

so we have to create the multiart form

290:09

data in that when we will add The Prompt

290:11

and we will make post request to this

290:14

API end point now in the response we

290:17

will get the

290:21

image and scroll

290:24

down here we have the option called

290:27

JavaScript so you can see in the request

290:31

we have to send the headers and in the

290:34

headers we have to send X API key and in

290:37

this API key we have to provide the API

290:40

key that we have added in the

290:41

environment variable so first we have to

290:46

create the multi-art form data that we

290:49

will send in the API request so just

290:51

come back to the VSS code and in this

290:55

image controller

290:57

function here we have to create the

291:01

multiart form data so we will add

291:05

const form data equal

291:09

to new

291:11

and we will use form

291:14

data let's scroll up and here we have to

291:18

import the form data so we will add

291:23

import form

291:25

data

291:27

from form data package we have already

291:30

installed this package while creating

291:32

the backend application right so now we

291:36

have this form data and using this form

291:38

data we will create this form data

291:42

variable right now in this variable we

291:46

have to append The Prompt so here we

291:50

will add this braet and after that we

291:53

will

291:54

add form

291:56

data do append

292:00

method and in this one we have to append

292:03

The Prompt so just

292:05

add

292:07

prompt comma and we will get get the

292:11

prompt from this

292:12

one just copy it and paste it here now

292:16

we have created the form data next we

292:19

have to send this form data on the API

292:24

so let's come back and copy the API end

292:27

point that is

292:30

here just copy and come back and here we

292:33

will make the API request for that we

292:36

will use the exos so we will add a wait

292:42

exos so you can see the exos has been

292:45

imported right now in this one we have

292:49

to make the post method so just add exos

292:54

do

292:56

post and here we will provide the API

293:00

end point this one and after that we'll

293:03

add the comma and we will provide the

293:05

form

293:07

data right again add the comma and here

293:10

we will add the curly

293:12

bres and in this one we have to provide

293:15

the headers as you can see

293:19

here this one so just copy this

293:23

headers add it here and in this headers

293:27

we have this x API key and here we have

293:29

to provide the API key so our API key is

293:32

stored in the environment variable so we

293:35

will add

293:37

process. EnV

293:41

dot clip drop

293:45

API now we have provided the clip drop

293:49

API key and here we have to add the

293:52

response type so we will

293:54

add response type and the response type

293:58

will be

294:00

arrayer like

294:02

this so now we have made the API call

294:06

and we will store the response here so

294:09

we will add

294:13

const CES data so in this data we will

294:17

store the response from this API call

294:21

right and now in this data we will get

294:23

the response as add a buffer and using

294:26

that add a buffer we have to convert the

294:28

image to base 64 so here let's add

294:35

const base 64 image

294:42

equal

294:44

to

294:46

buffer do

294:49

from and provide the

294:51

data and provide

294:56

binary and here we will make it as a

294:58

string so we will add two a

295:01

string and in this two a string method

295:04

we will provide base

295:08

64 and using this base 64 image we have

295:12

to generate the image URL so we will add

295:17

con result

295:19

image equal to we will add the back Tex

295:24

so that we can use the template literal

295:26

in this one we'll add data colum

295:31

image/

295:33

PNG colum base

295:37

64 comma we will add the dollar sign and

295:41

curly

295:42

bres and in this one we will provide

295:45

this base 64 image so now we have the

295:48

result image here now we have to send

295:52

this result image in the response and

295:55

before that we have to deduct the users

295:58

credit so first let's deduct the user

296:02

credit because we have already generated

296:04

the image so one credit will be deducted

296:07

so we will add await

296:11

user

296:12

model dot find by ID and update and in

296:17

this one we have to provide the user ID

296:20

so we will add user

296:23

doore ID correct then we will provide

296:28

CES here we will add creit

296:34

balance and in this credit balance we

296:36

have to update the balance so we will

296:38

add user

296:40

do credit balance minus

296:44

one like this so the users credit

296:48

balance will be reduced by one after

296:51

that we have to send the response so we

296:53

will

296:54

add response dot

296:58

Json and here we will add the object in

297:01

this object we will add the success

297:03

property that will be

297:06

true after that we will add the message

297:10

that will be image

297:12

generated next we have to send the

297:17

credit so we will add credit balance and

297:21

the credit balance will be user do

297:24

credit balance minus one right now we'll

297:28

add the comma and here we will send the

297:31

result image also we will

297:33

add result image so we will send the

297:36

result image in the response correct so

297:39

now we have have created

297:41

the controller function that will take

297:44

the prompt and it will generate the

297:47

image using that prompt and the

297:49

generated image will be sent in the

297:51

response that we can display on our

297:53

front end right next we have to create

297:57

the API Endo using this controller

297:59

function so just copy this controller

298:02

function and in the left side word you

298:05

can see here we have routes folder so in

298:08

this routes folder we will create a new

298:10

file

298:12

called image routes.js

298:17

in this one let's

298:20

add import Express from

298:25

Express after that we have to import the

298:28

image generate function so we will add

298:31

import

298:34

CES generate image that we have just

298:37

created we will import it from

298:41

double

298:42

do/ controller

298:45

SL image

298:49

controller.js right after that we have

298:51

to add router so just add

298:56

const image

298:58

router equal to

299:02

Express dot

299:06

router so we have created one router

299:10

using this express. router now in this

299:13

router we have to add the path and we

299:15

will provide the controller function so

299:17

that we can create the API end point so

299:21

we will add image router and here we

299:24

will use the post

299:26

method now in this one we will provide

299:29

the path so it will be SL generate image

299:34

so this is the API Endo generate image

299:38

after that we'll add the

299:41

generate image controller

299:44

function but if I come back to the

299:46

generate image controller function here

299:48

you can see we need the user ID from the

299:51

body so we will provide the user ID

299:53

using the middle Weare so here again

299:57

come back to the image routes and before

300:01

this one we will add the middle Weare so

300:03

we will add the

300:05

comma and here we will

300:08

add you user or middleware so this user

300:12

or middleware has been imported and we

300:14

have added this user or middleware that

300:16

will add the user ID in the body and

300:19

after that it will execute this generate

300:22

image controller function next we have

300:25

to export this router so here let's add

300:30

export

300:32

default and image

300:35

router that's it next we have to use

300:39

this image router in the server.js file

300:42

so let's open server.js file and let me

300:45

just duplicate this

300:48

line right and here we will add/ API SL

300:55

image right and here we will add the

300:57

router that

300:59

is image router so the image router has

301:03

been imported

301:04

correct so now we have added the

301:07

complete API Endo that that is/ API SL

301:11

image and

301:14

slash generate image correct after

301:17

adding this we have to test this API end

301:20

point so to test this API again open the

301:26

postman and here we will click on this

301:29

plus

301:30

icon right now in this one let's add

301:34

post method and provide the URL here we

301:37

will add/ API SL

301:41

image/ generate

301:44

image this one if I come back here you

301:47

can see we have generate image so we are

301:49

using the same end point / API SL image/

301:54

generate image correct now we have to

301:58

add the prompt in the body so in this

302:01

body let's add raw and here we will add

302:05

the object we will add

302:08

prompt and in this prompt let's add

302:11

flying

302:13

cat right now in this headers we have to

302:17

provide the

302:20

token and in this token we will provide

302:23

this token so let me just copy it and

302:26

paste it

302:29

here so in the headers we have provided

302:31

the token and in this body we have added

302:34

prompt after that if I click on this

302:37

send button here we have some error let

302:40

me come back to the VSS code and open

302:42

the terminal scroll down and here we

302:47

have some error in this terminal so

302:49

let's see cannot find module user model

302:54

that is imported from this image

302:58

controller.js so to fix this one let's

303:01

open image

303:03

controller.js and in this one you can

303:06

see we have added import user model from

303:09

models folder user model so here we have

303:12

to add the file name extension that is

303:15

user model.

303:18

JS add this save the changes and let me

303:22

hide this terminal and come back to the

303:24

postman and click on this send button

303:27

again so here we are getting the

303:29

response and in this response we are

303:30

getting success true message image

303:33

generated then we have the credit

303:35

balance for because the one credit has

303:38

been reduced for generating one image

303:40

then we have the result image and here

303:42

we have

303:44

this link so we can use this data to

303:47

display the image on our front end after

303:50

that if I come back to the database so

303:53

let's open this mongod DB database and

303:56

click on this refresh

303:58

button so now you can see the credit

304:01

balance has been reduced it is four

304:04

correct so now we have created the API

304:07

to generate the image so till now we

304:11

have created the API for user login

304:14

registration then we have created the

304:17

API for finding the users available

304:20

credit balance then we have created the

304:22

API for generating the image using

304:25

prompt now we will link these API with

304:29

our front

304:30

end to connect our backend apis with our

304:34

front end just come back to the vs code

304:37

editor and let me close all these

304:42

files and collapse This Server folder

304:46

right now expand this client

304:49

folder where we have added the front end

304:53

and in this one you can see we have

304:54

added the SRC and here we have the

304:57

context and app context. jsx file right

305:01

now in this one we have to get the

305:04

backend URL so we will store the backend

305:08

URL in the envirment variable so in this

305:11

client folder right click and select a

305:14

new file and here we will add the file

305:16

name

305:19

Dov right now in this environment

305:22

variable we will store the backend URL

305:26

so if I come back to the web

305:29

browser so you can see our back end is

305:31

running on this link Local Host Port

305:34

4,000 so just come back and here we will

305:37

add V

305:41

underscore backend

305:46

URL and add this URL in single or double

305:52

quote remove this forward slash at the

305:56

end so there will be no forward slash at

305:58

the end so we have added V backend URL

306:02

in this envirment variable after that we

306:05

will open app. context. jsx file and in

306:10

this one we will store the backend URL

306:12

in one variable so that we can access it

306:15

in any component so in this file

306:22

here before this

306:25

value let's

306:27

add

306:31

const backend URL is equal to import do

306:38

meta do

306:41

EnV

306:44

dot V backend

306:49

URL so we have added the backend URL in

306:52

this variable next we have to pass this

306:54

backend URL in other component so we

306:57

will provide it in this value object so

306:59

just add comma and provide this backend

307:02

URL in this

307:04

value right after that we have to add

307:08

the token State variable so that we can

307:12

store the token in the local storage and

307:15

we can also get the token from the local

307:16

storage and in that token variable we

307:20

will store the token generated from the

307:22

API so that we can enable the login and

307:25

registration featured on this

307:27

application so here let's add

307:33

const and we will add the state variable

307:37

name called token

307:43

and the setter function name will be set

307:52

token here we will use user

307:56

State and here we will initialize the

308:00

value using local storage of the web

308:03

browser so we will add local storage dot

308:08

get item and in this one we will provide

308:11

the key name that is token so if there

308:14

is any token available in the browser

308:17

local storage that will be stored in

308:19

this estate

308:22

variable so here we have the user then

308:25

we have the so login then we have this

308:29

token estate after that we will add one

308:31

more state that is credit so we will add

308:36

cost credit and we'll will

308:40

add set

308:44

credit is equal to use a

308:48

state and we will add

308:53

false after creating these State

308:55

variables we have to pass it through

308:58

value object so that we can access it in

309:00

any component so let's add it in this

309:04

value object we will add the comma and

309:07

paste it token and set token then again

309:11

add comma and we will pass this credit

309:13

and set

309:15

credit right save the changes next we

309:18

will add the login and registration

309:21

functionality for that let's

309:24

open components and go to login. jsx

309:28

file and in this one we will add the

309:30

functionality for login and registration

309:33

so in this one you can see we have added

309:36

different input fields for name email ID

309:40

and password so we have to store these

309:44

values in a state variable for that we

309:46

will create three state variable with

309:48

the name name email and password so

309:52

let's start with first variable here we

309:56

will

309:57

add

309:59

const

310:03

name set

310:05

name is equal to user state

310:10

and initialize it with empty string

310:13

let's duplicate it and here we will add

310:16

email it will be set

310:19

email now duplicate it this will be

310:25

password and it will be set

310:31

password right now we have to link these

310:34

state with the input Fields so scroll

310:38

down

310:41

and here we have this first input field

310:44

that is for the full name right so in

310:47

this one we will add the onchange

310:51

property like this and in this one we

310:54

will add

310:57

event and create the arrow

311:00

function and here we will use the seter

311:02

function that is set

311:05

name and in this one we have to provide

311:08

the value from this input field for that

311:11

we will add e do Target dot

311:16

value after that we have to provide the

311:19

value property so after this curly bres

311:23

let's add a space and we will add the

311:25

value property and in this one we will

311:27

add name State like this now let me just

311:32

copy this one and we will paste it in

311:34

this second input field that is for the

311:36

email so paste this on change and value

311:40

and here we will add set

311:44

email and here we will add e. target.

311:48

value and it will be

311:51

email now in the third one that is that

311:54

is for the password input field let's

311:58

add this on change just copy and paste

312:04

it and here we will add set password

312:11

and in this value we will provide

312:14

password now whenever we will enter

312:16

anything in these input field that data

312:19

will be stored in these State variable

312:22

right so now we have to pass this name

312:25

email and password on our API to create

312:29

an account and if you want to log to the

312:32

existing account then you have to pass

312:35

only email and password correct so now

312:38

we will create the function that will

312:40

either create an account or it will

312:43

login to the existing account for that

312:48

here in this

312:53

form it's

312:55

here we have this form tag so in this

312:57

form we have to add the onsubmit

313:01

property we will

313:03

add unsubmit and here we will add one

313:07

Handler function so we will add

313:09

on submit

313:12

Handler next we have to declare this on

313:15

submit Handler function so scroll up and

313:19

before this use effect let's add a

313:23

space and here we will create this on

313:27

submit Handler function so we will add

313:30

const function name and it will be as

313:33

synchronous function because here we

313:35

will add the API call here we will get

313:39

the

313:41

event and now we will use this event to

313:44

prevent the default functionality so we

313:46

will add e do prevent

313:51

default so after adding this it will

313:53

prevent the web page from reloading

313:55

whenever we will submit the

313:57

form after that we will add the TR catch

313:59

block for the API call so just add the

314:02

TR catch and in this one first we will

314:06

check for the estate here we have have

314:09

the estate so if the estate is login

314:12

then we will call the login API and if

314:14

the estate is sign up then we will

314:16

create the user registration API so here

314:21

in this Tri block let's

314:26

add if statement and we will add state

314:31

if the estate is equal to

314:36

login then what will happen we have to

314:39

call the login API so for calling the

314:43

API we will use the exos so we will add

314:50

await

314:54

exuse let me check whether we have added

314:57

the exos package or not so if I go

315:00

to package.json

315:04

in this

315:09

dependencies you can see we have the

315:10

motion react react Tom and react router

315:14

Dom so we don't have AOS here so we have

315:17

to install the AOS right

315:21

so let's close it and we will open the

315:27

terminal so this is the terminal for

315:30

backend server and if I click

315:33

here now it is the terminal for front

315:38

end so first we have have to stop it so

315:40

just add crl C yes now we will add

315:45

npm

315:47

install

315:55

exos after installing the xos package

315:59

here we can use await

316:01

xos dot post

316:06

method and we have to import this exos

316:09

in this file so scroll

316:12

up here we will

316:16

add import exos

316:20

from exos

316:24

package now here we will add exos dopost

316:27

method and in this post method we have

316:29

to provide the backend URL so our

316:32

backend URL is available in the context

316:35

file so we have already imported this

316:38

data from the context so in this one

316:40

only we will

316:43

add backend URL so the backend URL will

316:47

be imported from the context and we can

316:49

use it in this post method now in this

316:53

backend URL we have to provide the

316:55

complete path of the user login API so

317:00

we will concatenate the remaining path

317:04

so we will add slash API slash user

317:09

slash login that is the login end

317:14

point now in this one we have to provide

317:16

the email and password so we will add

317:18

the comma and we will add one object and

317:23

in this one we will pass

317:25

email comma

317:28

password right for the for the login we

317:32

need only email and

317:34

password after that we will get one

317:37

response so we will store that response

317:39

here we will add

317:42

con C lies

317:46

data so in this data we will get the

317:48

response next we will check for the

317:51

response so here let's add if statement

317:56

and in this one we'll check if the data

318:01

dot

318:04

success is true if the data. success is

318:07

true it means we are successfully logged

318:10

in so after login what we have to do we

318:13

have to get the token from the response

318:16

and we will set the token available in

318:18

this app context here we have added

318:21

token and set token so in this one we

318:24

have to find the set token using this

318:28

app

318:33

context now just copy it and here in

318:35

this if statement we will add set token

318:39

and provide

318:41

data.

318:44

token because we are getting the token

318:46

in the response after

318:48

login after that we have to set the user

318:51

also so here we have to get the user

318:54

from the context so we will

318:57

add set

319:02

user if I come back here you can see we

319:05

have set user which is null right so we

319:07

have added this yes so we have added

319:10

this set user in this login. jsx file

319:14

and here after adding the token we will

319:17

add set

319:20

user and in this one we will add data.

319:24

user correct after that we have to store

319:28

the token in the browser's local storage

319:31

for that we will add local storage

319:34

dot set item and provide the key name

319:39

token then provide our token that we are

319:42

getting from the response we will add

319:44

data dot

319:48

token next we have to hide the login

319:51

form so to hide the login form we will

319:54

use this set so login and we will make

319:57

it false so that the login form will be

320:02

hidden that's

320:05

it so if the data. success is true these

320:09

code will be executed but if the data.

320:12

success is false then we'll add the else

320:14

condition and here we will add one error

320:19

message and we will display the error

320:21

message in a toast notification so to

320:24

display the toast notification we need

320:27

a toasttify package so if I come back to

320:31

the web

320:34

browser and open a new tab and search

320:38

for

320:40

react toasttify open this

320:44

website so here we have the command to

320:46

install react toasttify in application

320:49

so just come back and open the

320:52

terminal here we are in the client

320:55

folder right so we have to WR contrl C

321:00

it is already stopped so here we will

321:02

just add npmi react toasttify press

321:06

enter

321:11

after that we will

321:12

add npm run Dev so it will again a start

321:16

our

321:18

project so our project is running on

321:20

this Local Host

321:22

5173 hide this

321:24

terminal now you can see the next step

321:27

to add this notification so we have

321:29

added

321:31

this npm install that will install the D

321:34

T5 package and after that we have to use

321:36

this import a statement

321:39

so just copy

321:41

it and come back to the app.jsx

321:46

file so in the client folder we will

321:50

open

321:54

app.jsx and here let's add this import

321:59

statement we have added

322:01

import toast

322:03

container and from here just remove this

322:06

toast it is not required and here we

322:09

have added import react toy. CSS correct

322:14

after that we have to add this toast

322:18

container component here in this return

322:22

so in this return we have this div so

322:24

before this navigation bar let's add a

322:26

space and we'll add opening tag toast

322:30

container and close this tag in this

322:33

toast container we can add the position

322:36

also so we will add the position and it

322:38

will will be bottom

322:43

right so the notification will be

322:45

displayed in the bottom right

322:47

side correct after that we will open

322:50

login. jsx file and here if I want to

322:54

add the toast notification then we can

322:57

simply

322:59

add toast click here so you can see the

323:04

toast has been imported from react

323:06

toasttify then we will add add the error

323:09

type so toast.

323:12

error and in this one we will add

323:16

data Dot

323:20

message so if any error occurs or if the

323:23

data do success is false then one eror

323:27

will be displayed in toast

323:31

notification so we have added the

323:34

functionality for login in this if

323:37

statement right so this if statement is

323:40

checking if the estate is login then

323:43

this code will be executed but if the

323:46

estate is not equal to login it means

323:48

the estate is sign up in that case we

323:50

have to call the registration API it

323:53

means the user registration

323:55

API right so here we will add the else

323:59

condition for this if

324:01

statement so we will add

324:05

else and here we will make the API call

324:09

so again copy this

324:12

one or let me just copy

324:15

everything from here we will copy

324:18

this and paste it here in this else

324:21

statement now in this else statement we

324:23

will add con data await exos dopost

324:26

backend URL and here we have to change

324:29

the API endpoint it will be / API SL

324:33

user SL

324:36

register register for the user

324:39

registration API endpoint right and for

324:42

the registration we have to send the

324:44

email password and we have to send the

324:46

name also so we will add name comma

324:50

email comma password right after that we

324:54

will get the response in this data and

324:56

we will check if the data. success is

324:58

true then we will set the token then we

325:01

will set the user and then we will set

325:04

the local

325:05

storage using this data token and we

325:09

will set so login false so it will hide

325:12

the registration page or login page

325:15

after that if this data. success is

325:18

false then the error message will be

325:20

displayed in the

325:21

notification to. error is equal to data.

325:25

message so now we have added the

325:27

functionality for this user login and

325:31

registration now if any error occurs in

325:34

this Tri block then this catch block

325:37

will be executed so in this catch block

325:40

simply add this toast.

325:44

error is it toast.

325:47

error error do

325:50

message that's it after adding this

325:54

let's come back to the web

325:56

page and we will open our

326:02

homepage and here if I click on this

326:04

login button it is opening this login

326:07

form right now let's create a new

326:11

account so just click on this sign up

326:13

button and here we will add the

326:17

name

326:20

abinas and after that we'll add the

326:22

email ID so let's add the email ID

326:30

here after that we will add the

326:34

password and click on this create

326:37

account

326:39

now you can see our account has been

326:42

created and we are logged in that's why

326:44

we are getting this navigation

326:47

bar with profile icon log out option and

326:51

this credit and this text right now

326:54

these text are a static so we have to

326:56

get this credit and this username from

326:58

the API and we will display it in the

327:01

navigation bar correct so for that let's

327:05

come back

327:08

and in

327:11

this app context. jsx

327:15

file here we have added this credit

327:19

right so we have to find the credit

327:21

using the

327:22

API to get the credit we will create a

327:26

function so

327:28

here before this

327:31

value let's

327:34

add const

327:39

load Credit Data or load credits

327:45

data equal to asnc

327:52

function and to get the credit we have

327:56

to call the API so we will add the TR

327:59

catch block and in this catch block we

328:02

will add

328:04

the

328:05

statement console.log error and toast.

328:09

error error. message so to get this

328:12

toast. error we have to import this

328:15

toast so let's select it from here so

328:18

this toast has been imported from react

328:20

toasttify

328:22

right now here in this Tri block we will

328:26

call the credits API and we will store

328:30

the data in this data variable so we

328:33

will add

328:35

const CES data

328:39

is equal to a

328:42

wait and we will use the

328:46

xos and in this xuse we will use the get

328:52

method and we have to import this xos

328:55

also so here scroll up and we'll

328:58

add

329:01

import exos

329:05

from exos package and in this one we are

329:09

using this get method so let me just

329:11

come back to the backend folder again

329:13

and uh in the server folder we have

329:16

created this routes and in this routes

329:19

we have the user routes.js so you can

329:22

see here we have added the post method

329:24

for user credits so let me change it I

329:27

will add get that's

329:32

it so we will add the get method now in

329:36

this load create this data we will call

329:39

the API using this get

329:41

method now in this one we have to

329:43

provide the backend URL so just

329:46

add backend URL and in this one we will

329:49

concatenate the end point so we will add

329:53

forward SL API

329:56

sluser SL

330:01

credits after that we will add the comma

330:03

and here we will add one object and in

330:06

this object we will add headers

330:10

and in this headers we have to provide

330:12

the token so we will add one object and

330:15

here just add token that's it so now we

330:19

will get the response in this data after

330:24

that we will check the response so we

330:26

will add if statement and we will check

330:29

if data dot

330:33

success is true if this data. success is

330:37

true

330:38

then we will set the credit so just add

330:42

set credit and here we will

330:46

provide data do

330:51

credits after that we will set the user

330:53

also so we will add set

330:57

user and it will be data do

331:04

user so we have added this function that

331:07

will load the the data from the API next

331:09

we have to execute this function so to

331:12

execute this function we will use use

331:15

effect so before this value let's

331:21

add use

331:23

effect select it from here so use effect

331:26

will be imported from react now in this

331:30

use effect we will add one Aro

331:34

function and we will add the dependency

331:36

array

331:38

and in this dependency are we will add

331:41

token so that whenever the token will be

331:44

changed then this addo function will be

331:47

executed so here just add the if

331:50

statement and it will check if token is

331:54

available right so if the token is true

331:57

then it will call this function that is

332:00

load credits

332:02

data so it will load the credits

332:05

data next we have to pass this load

332:08

credits data in this value object so

332:11

that we can access it in any other

332:13

component

332:14

also so we have added it here save the

332:19

changes and after adding this load

332:21

credits data we need to add one more

332:24

functionality that is log out so that

332:26

user can log out from the account so let

332:29

me add that feature also we will add

332:35

cons log out is equal to Aro

332:42

function and here we will add local

332:46

storage

332:48

dot remove

332:50

item and it will remove the item with

332:53

the key name

332:55

token after that it will set the

332:59

token with mt

333:02

string then we will set the user set

333:06

user it will be null

333:10

now we have to pass this log out

333:12

function also so here in this value

333:15

object we will add this log out save the

333:19

changes and now let's come back to

333:23

the nav bar. jsx file so in this nav

333:27

bar. jsx file you can see here we have

333:30

this user set so login now in this one

333:34

we need the log out function so just add

333:39

log out we will get it from App context

333:41

right after that we need the credit so

333:44

just

333:44

add

333:46

credit and here we have the user and set

333:50

so login that's it now using this credit

333:53

we will display the credit in the

333:54

navigation bar button and we will also

333:56

display the users's name using this

334:00

user after that we will link this log

334:03

out function with the button so scroll

334:06

down and uh here

334:08

you can see we have this credit left so

334:13

here instead of adding this value 50 we

334:16

will add curly braces we will add credit

334:20

State that's it after that here we have

334:26

this log out button so in this Li tag we

334:30

will

334:31

add on click and in this on click we

334:34

will provide this log out function

334:38

after that if I come here in this P tag

334:41

here we have added the name manually so

334:44

let me remove this name and here we will

334:46

add curly bres and we will

334:48

use

334:50

user.name

334:52

so we will get the name from the user

334:56

state after adding this if I come back

334:59

to the web

335:02

page and refresh this and click on this

335:06

login

335:08

here we will login with existing account

335:10

so let's

335:14

add we have added the name then we will

335:17

add the

335:18

password and click on this login button

335:21

so now we are successfully logged in and

335:23

here we have this name right and this

335:27

credit is not displaying here and let's

335:29

see this log out option we will click

335:31

here now we are logged out so this log

335:35

out feature is working registration is

335:37

working and login is working but the

335:39

credit was not displayed so let me login

335:46

again so let's see what's the error with

335:49

this

335:58

credit let's open login. jsx file and

336:02

here you can see we have added this

336:05

local storage. G get item so insteed of

336:09

this get item it will

336:11

be set item local storage do set item

336:15

token and here also we will add this

336:18

local storage set

336:22

item that's it save the changes and come

336:25

back to the web browser login

336:35

again still this cre is not displaying

336:39

so let me just come

336:41

back and in this app context. jsx file I

336:45

have added data do success but this

336:48

spelling is incorrect so we will correct

336:51

data do

336:53

success if it is true then set credit

336:56

and set

336:57

user save the changes and again come

337:00

back to the web page now you can see

337:02

here we are getting the credit left five

337:06

correct and here we have the users's

337:08

name and if I click on this log out

337:11

button we will be logged out from this

337:14

account so now we are logged out now

337:17

let's try to login with different

337:20

account so we will click on the login

337:21

button again and here we will add the

337:25

first account that is user. gr@

337:33

gmail.com then we will add the password

337:36

and click on login

337:38

button here it says user does not exist

337:42

so let's collect it user

337:46

dot user. creest

337:52

tack let me check the database refresh

338:02

it so here we have this email ID

338:05

greatest td@ gmail.com

338:07

so let me add this email ID in the login

338:13

form and click on the login

338:17

button now we are logged in and here we

338:19

are getting the available creit for and

338:22

here we have this name greatest tag

338:26

correct because in

338:28

this user data you can see the name is

338:30

greatest tag and this is the email and

338:32

here we have the credit balance for

338:35

correct so now we have added the the

338:37

login and log out functionality on this

338:40

application and we have displayed the

338:43

available credit also correct next we

338:46

have to add the functionality to

338:48

generate the image using prompt for that

338:51

we have to create a function that will

338:53

call the image generate API so let's

338:57

come back and we will come to app

339:00

context. jsx file and in this

339:05

one after this load credits data here we

339:09

will create another function we will add

339:14

const generate

339:18

image equal to a

339:21

sync and create the arrow

339:26

function and in this one we will take

339:29

the parameter

339:32

prompt because to generate the image we

339:35

need the prompt now in this one we have

339:38

to make the API call so we will use the

339:41

try catch

339:43

statement and here in this catch block

339:46

we will add

339:48

the error message in the notification so

339:50

just add toast.

339:55

error and we will add error do

340:01

message the toast has been imported here

340:06

right now now in this Tri block we will

340:09

call the image generate API that we have

340:12

created in our back end so let's add a

340:16

wait and we will use the

340:20

exos and here we will use the post

340:24

method and here let's add the backend

340:28

URL and in this backend URL we have to

340:30

concatenate the API end point so just

340:34

add/ API slash

340:38

image

340:40

slash generate

340:44

image we have already tested this API

340:47

right so we are so we are calling this

340:50

API and in this one we have to send the

340:53

prompt so after this API end point just

340:56

add the comma and add the CES and in

340:59

this one we will provide

341:02

prompt correct after that we'll add

341:04

comma and here we'll add one object and

341:07

in this one we will pass the

341:10

headers and in this headers we will

341:12

provide

341:17

token after that we will store the

341:20

response in one variable so just add

341:24

con calies data so we will store the

341:29

response in this data next we will check

341:31

this data so we will add the if

341:35

statement and here we will check if the

341:37

the data

341:39

dot success is

341:41

true in that case we will load the

341:44

credit so here you can see we have added

341:47

this load credits

341:54

data so that after generating the image

341:58

it will again display the avable

342:02

credit then we will

342:04

add return so it will return the result

342:08

image so we will add return data

342:12

dot result

342:15

image that we are getting from the API

342:18

response here we will add the elsea

342:21

statement also so if the data do success

342:24

is false in that case we will

342:27

add toast.

342:30

error and here we will display the error

342:33

message that we are getting from the API

342:36

response so just add data do

342:41

message after that again we will call

342:44

this load Credit

342:47

Data and here we will check

342:51

if

342:52

this

342:54

data

342:56

Dot credit

342:58

balance if this data do credit balance

343:01

is equal to zero if this credit balance

343:06

is zero then the user will be redirected

343:09

to the Buy credit page so to redirect

343:12

user on the Buy credit page we will use

343:14

the navigate function for that

343:19

here before this function let's add

343:24

const navigate is equal to use navigate

343:30

hook correct now just copy this navigate

343:34

and uh here in this if statement if the

343:38

data do credit balance is zero then we

343:41

will redirect the user on the Buy credit

343:44

page so just add navigate function and

343:47

we will provide the path that is

343:49

slash

343:52

by that's it after that let's come back

343:56

to the web

343:59

page after that we have to call this

344:02

generate image function whenever we will

344:04

click on the button so let's come back

344:08

to the result

344:10

page so here we have the result. jsx

344:15

file right so in this one we have to get

344:19

that function before that we have to

344:21

pass this function using this value

344:24

object so in this value object let's add

344:26

this function that we have just created

344:28

generate image now we can access this

344:31

function in any component correct after

344:34

that let's open result. jsx

344:37

file in this one we have to get the

344:40

function from the app context so here

344:43

let's

344:44

add

344:46

const generate

344:49

image equal

344:51

to use context use context has been

344:55

imported and here we will add the app

344:59

context this app context has been

345:02

imported right after importing it here

345:06

we we have this onsubmit Handler

345:09

function so this function will be

345:11

executed whenever we will submit the

345:14

form where we will add the prompt in the

345:17

input field and click on the submit

345:19

button then this on submit Handler will

345:22

be executed so in this one let's add

345:27

event dot prevent default so it will

345:31

disable the page reloading whenever we

345:33

will submit the form after that we have

345:36

to set the loading State true so just

345:38

add set

345:40

loading this set loading is already

345:42

available here right so we will make the

345:44

set loading

345:46

true correct after that we'll add if

345:50

statement and we'll check if the input

345:53

is available it means we have some

345:56

prompt in the input field so if the

345:59

input is available then we will add

346:03

const

346:05

image and we will we will add a weit and

346:09

we will call the generate image function

346:12

so just use this generate image function

346:16

here and in this one we have to provide

346:18

the prompt that is this input so we have

346:21

provided the input in this generate

346:23

image function so we will get the image

346:25

here right after that we will add if

346:30

statement and here we will check if the

346:32

image is available right then what will

346:35

happen we will set the image so just add

346:38

set image

346:40

loaded we will make it

346:44

true and after that we'll add set

346:47

image and here we will provide the image

346:50

that we are getting from the

346:52

response so the image will be added in

346:55

this state variable and we will set the

346:58

image loaded true after that we have

347:01

to disable the loading right so here

347:05

let's add

347:08

set loading

347:12

false that's

347:14

it after adding this let's come back to

347:17

the web

347:20

browser and we are already logged in now

347:24

just click on this generate image button

347:26

so it will open this page here we have

347:28

the default image and here if I write

347:31

any prompt so let me

347:34

write White

347:38

cat playing with

347:44

apple click on generate

347:48

button here it says request failed with

347:51

a status code for not

347:55

for

347:57

so let's check

348:02

it let's go to app context and uh

348:07

scroll up where we have added the

348:10

function for Generate

348:13

image here it is so in this one you can

348:16

see we have added the incorrect path so

348:19

it will be/

348:21

API SL image SL API SL image/ generate

348:26

image collect this API endpoint path

348:30

save the changes again come back now

348:33

let's add the prompt again

348:39

white cat playing with apple and click

348:41

on generate button now you can see this

348:44

loading

348:47

right and after loading you can see we

348:50

have the image generated according to

348:52

our

348:53

prompt correct now we can click on this

348:56

button to download this image so let me

348:59

click here so this image has been

349:01

downloaded right let me click here so

349:04

this image will be displayed

349:08

so you can see we have downloaded this

349:10

image that is generated using

349:13

AI now you can see the credit has been

349:15

reduced here we have the credit left

349:17

three correct here we have the button

349:21

called generate another so it will again

349:23

open this input field where we can type

349:27

another prompt and we can also go to

349:30

homepage and scroll down here also we

349:33

have this button so if I click on this

349:35

button it will again open this result

349:38

page right so here let's type another

349:42

prompt we will

349:47

add black cat flying and click on the

349:50

generate

349:51

button now you can see this

349:57

loading and after generating the image

350:00

the loading text is hidden and here we

350:02

have one image that is generated using

350:06

AI using our prompt so this image

350:10

generator is working fine and the credit

350:12

has been reduced you can see the credit

350:15

left two and if I go to database refresh

350:22

it and now you can see here we have the

350:25

credit balance to correct now let me

350:28

make it zero here we will make it

350:31

zero click on

350:34

update and refresh this

350:38

website now you can see the credit is

350:40

zero correct now if I enter any prompt

350:44

here we will

350:46

add white flying cat and click on this

350:51

generate

350:53

button now you can see this notification

350:56

no credit balance right because the

350:59

credit balance is zero and we are

351:01

redirected to the Buy credit

351:04

page so next we have to add the payment

351:07

Gateway on this application so that we

351:09

can purchase more credit to generate

351:13

images here I'm am going to use the

351:15

Razer pay payment gway that is very

351:18

popular in India for online payment

351:20

method but if you want to use a stripe

351:24

payment gway then you can check out the

351:26

source code link provided in the

351:28

description where I will provide both

351:31

Razer pay and a stripe payment

351:33

integration now to add the Razer pay

351:36

payment getaway in this project first

351:39

let's open the razerpay website so come

351:41

to this website Razer pay.com and here

351:44

you have to create an account so just

351:46

click on this sign up button and here

351:48

you have to provide your phone number or

351:51

email ID and click on this continue

351:54

button then complete your profile and

351:57

after completing your profile you will

351:59

come to the Razer pay dashboard and from

352:02

there you can copy the Reser pay secret

352:05

key and rer pay key ID so you have to

352:09

copy two things Razer pay key ID and

352:11

Razer pay key secret from the razor pay

352:15

dashboard so I have already generated

352:17

the razor pay key ID and secret that I

352:20

will use in this project so let me just

352:23

come back to the vs code and let's close

352:26

all these

352:29

files and from this left side bar we

352:33

will open This Server folder that is our

352:36

backend in this one we will open

352:39

controllers and go to user

352:42

controller and in this user controller

352:44

file we have to create a controller

352:46

function to initialize the razor pay

352:49

payment Gateway but before that we have

352:52

to store the secret key and secret ID in

352:57

this EnV file so let's open EnV file in

353:01

this backend and here let's add

353:05

envirment variable name Razer pay key ID

353:09

and here you have to store the Razer pay

353:12

key ID after that we have to store the

353:14

Razer pay key secret so just add the

353:18

variable name Razer pay key secret and

353:21

store the secret key here after that we

353:25

have to store the currency so we will

353:28

add currency and in this currency we

353:31

will add

353:33

INR because I have created my res page

353:36

pay account in India so I'm adding the

353:39

Indian currency INR and let me provide

353:42

the key

353:43

ID and key

353:46

secret so here I have provided this

353:49

razor pay key ID and key secret and

353:53

currency after that let's come back to

353:55

the user controller.js file and here we

353:58

will create the controller function but

354:01

before that we have to initialize the

354:03

razor pay so first we have to import the

354:06

Reser pay so just scroll up and here we

354:10

will

354:11

add

354:17

import RoR pay

354:20

from RoR pay we will add it in code

354:25

after that here we will

354:27

add

354:32

const razor pay instance

354:39

and we will create the instance using

354:41

the razor pay so we will add

354:44

new razor pay

354:47

and to create this razor pay instance we

354:50

have to provide the key ID and secret

354:54

key so just

354:56

add key ID property and in this one we

355:00

have to get the key ID that we have

355:02

stored in the environment variable so we

355:05

will get it from environment variable

355:07

just add

355:08

process dot

355:11

EnV Dot and the variable name is Razor

355:15

pay key ID correct let's add comma and

355:20

here we will add

355:21

the second property that is key secret

355:26

and here also we will add the value from

355:29

involement variable so just add this

355:32

process. EnV

355:34

Dot and the variable name Razer pay key

355:39

secret so just add it

355:42

here that's

355:44

it so we have added this Razer pay

355:47

instance now we will add the controller

355:51

function so we can make the Razer pay

355:54

payment so just add

355:58

con and the function name is payment

356:01

Razer

356:04

pay equal to a

356:08

sync and here we will get request and

356:14

response in this one we will add the TR

356:16

catch

356:18

block and in this catch block let me

356:22

add console

356:26

log and provide this

356:30

error after that we will add

356:33

response do Json

356:36

and in this response we will send one

356:39

object with success

356:43

fals and in the message we will add eror

356:47

do

356:50

message like this now we will add the

356:53

logic in this Tri block so in this one

356:57

first we need the user ID and the plan

357:01

ID for making the reserve pay payment

357:05

right so here let's add

357:09

const cly

357:11

say user

357:16

ID right next we need the plan

357:24

ID and we will get it

357:27

from request. body so we will

357:31

add request do body

357:36

after that we have to find the user

357:38

using this user ID for that we will add

357:43

const user data is equal to

357:47

await then we will use the user model to

357:50

find the

357:52

user user model do find by ID and here

357:57

just provide this user

358:01

ID correct now we have this user data so

358:06

here we will add one if statement that

358:09

will check whether the user data is

358:10

available or not and we will also check

358:13

whether the plan ID is available or not

358:16

so we'll add if

358:18

statement and here let's

358:21

add not of user if the user is not

358:24

available

358:27

or this plan ID is not

358:31

available so if any of this is missing

358:34

then we will add return

358:39

and here we will add the response so

358:42

let's copy this response paste it here

358:46

response. Json success false and in the

358:49

message we will add missing

358:52

details so let's add this

358:55

message missing details right now

359:00

suppose we have the user ID also and

359:02

plan ID also so in that case we will

359:05

create

359:06

some variables where we will store the

359:09

credit plan amount and date so here

359:13

let's add

359:14

let

359:16

credits then we'll add plan then we will

359:20

add amount and then we will add

359:24

date so in any transaction we will store

359:28

the credit and the plan name or plan ID

359:32

then we will store the amount and date

359:35

correct

359:37

now here we are creating the controller

359:40

function and in this controller function

359:42

we will get different plan right because

359:45

we have created three plans on our web

359:47

page if I come back and here you can see

359:50

we are getting basic Advanced and

359:52

business plan so we have to add the

359:55

switch statement that is switch case

359:58

statement so here we will

360:01

add switch case and here we will add the

360:04

plan ID

360:07

so we are getting this plan ID from this

360:09

request body correct So based on this

360:12

plan ID we will

360:14

add different plan credit and amount so

360:18

in this plan ID there will be three

360:21

condition like basic Advanced and

360:24

business and in the basic we will get

360:28

100 credit and the amount is $10 in the

360:32

advanced it will add 500 credit and the

360:36

amount is

360:37

$50 and in this business we have the

360:41

5,000 credits and the cost is

360:45

$250 correct so we have to add it in the

360:48

switch case statement so just come back

360:50

and here in this first case we will add

360:53

the plan ID that is

360:57

basic and in this basic plan we have to

361:01

add

361:03

the plan

361:06

basic credits 100 and amount 10 so in

361:10

this credits we will add 100 plan will

361:12

be basic and the amount will be 10 for

361:15

the first case right now let me just

361:19

duplicate this

361:21

one and here we will add

361:24

the second case that is

361:28

Advanced and in this one we will add the

361:30

plan name Advanced and the credit will

361:33

be 500 and the amount will be be 50 now

361:37

again duplicate

361:39

it and this will be the third case and

361:43

here we will

361:44

add business here also we will add

361:48

business plan and here let's add the

361:50

credit 5,000 and the amount is

361:55

250

361:57

correct now in this default we will add

362:00

return statement so let's add

362:09

return response.

362:12

Json and here we will return one object

362:16

so in this object we will add success

362:18

false and we will add the message plan

362:21

not found so if the plan is not equal to

362:24

basic Advanced or business then it will

362:28

return the response with message plan

362:32

not found and the success will be false

362:35

right

362:36

so now we have the credits plan and

362:40

amount for the transaction next we need

362:42

the date right so here after

362:47

this switch case let's

362:51

add date and in this one we will

362:58

store date do

363:02

now so it will store the current date

363:05

time

363:06

stamp right after that using

363:10

this variables we have to create one

363:13

object that will store all the

363:15

transaction data right so here let's add

363:22

const we will add transaction

363:27

data and it will be one object and in

363:31

this object we will store user ID

363:36

then we will store the

363:40

plan then we will store

363:44

amount then we will store

363:49

credits and we will also store the

363:53

date so now we have this transaction

363:57

data next we have to store this

363:59

transaction data in the mongod DB

364:02

database so to store this transaction

364:05

data in mongod TV database we need to

364:08

create one model so in the left side bar

364:10

we have the models folder and in this

364:13

one we'll create a new model file so

364:15

let's right click on this models folder

364:18

select new file and here we will

364:21

add transaction model do

364:27

JS and in this one we have to add the

364:29

mongod DB model so let me just copy the

364:32

model from user model let me just copy

364:35

everything from here and paste it in

364:37

this transaction model and here we will

364:40

update the name so let me update the

364:45

name like transaction schema right and

364:51

here we will

364:52

add transaction

364:57

model like

364:59

this and we will use this transaction

365:02

schema here

365:06

and the model name will be

365:11

transaction correct let me remove

365:15

everything from here so you can see here

365:17

we have created the transaction schema

365:19

using new do schema and using this

365:22

schema we are creating one transaction

365:25

model and uh here we will

365:29

add

365:30

transaction so first it will search for

365:33

the model with the name transaction if

365:36

it is not available then it will create

365:38

one model with this name transaction

365:40

using this transaction schema right and

365:43

after that we have to export this

365:45

transaction model using this export

365:48

default so we will export it here now in

365:51

this one we have to define the schema so

365:55

you can see we have added this

365:57

transaction data where we have the user

366:00

ID plan amount credits and date so we

366:03

have to store these things in the

366:05

database so in this schema let's

366:08

add user

366:11

ID and in this user ID we will add the

366:15

type so the type will be a

366:21

string correct after that we have to add

366:24

the required so the user ID will be

366:28

required to store any transaction so

366:30

just

366:33

add required

366:41

true correct let's add the comma and

366:44

duplicate this line here we will add

366:49

plan so this plan is also a string type

366:53

and the required will be true now

366:55

duplicate it here we will add

367:02

amount and in this one we will add the

367:05

type

367:08

number and it is also required true now

367:12

let's add one more line and here we will

367:15

add

367:19

credits and the type will be number

367:22

required true after that we'll add the

367:26

payment so just add

367:30

payment and the type will be Boolean

367:37

and here we will add the default value

367:40

so just

367:44

add default and the default value will

367:47

be false so here we have added the type

367:51

bullan so it can be either true or false

367:56

after that we need to add one more

367:58

property that is

368:00

date that will be the transaction date

368:03

so here we will just add the

368:06

type so the typee will be

368:12

numbered that's it so here we have

368:15

created this transaction schema and

368:16

using this schema we have created the

368:18

transaction model and the transaction

368:20

model is exported from this file so we

368:23

can access this transaction model in any

368:26

file and we can store the data using

368:28

this transaction model so let's come

368:31

back here in this user controller and in

368:36

this

368:37

one here we will

368:42

add

368:45

con new

368:48

transaction is equal to a

368:52

weit then we will add transaction model

368:56

that we have just created so this

368:58

transaction model is not coming in the

369:00

suggestion so we have to import it

369:04

so let's scroll

369:08

up and here we will

369:10

add import transaction model

369:17

from Models

369:19

folder transac model. JS file so now we

369:23

have imported this transaction model and

369:26

here we will use it to store the data in

369:29

the database so we'll add await

369:32

transaction model dot create

369:37

and in this one we have to provide the

369:39

transaction data that we have added here

369:42

so just add this transaction data so it

369:45

will store this transaction data in the

369:47

mongod DB

369:48

database so now we have this transaction

369:52

data that is stored in the mongod DB

369:54

database after that we have to create

369:57

one order using razor pay so to create

370:00

the order here we will add

370:03

await we will use the razor pay

370:08

instance dot

370:12

orders dot

370:16

create and in this create we have to

370:19

provide one

370:22

options and then we'll add

370:25

one Arrow

370:29

function and in this parameter we will

370:32

get the

370:34

error and and we will get

370:37

order so if any error occurs while

370:40

creating the order then we will get the

370:44

error in this parameter and if the order

370:47

will be created then we will get the

370:49

order in this

370:51

parameter correct now here we need the

370:54

options right so first we have to create

370:57

this options so just copy this options

371:00

and here before this RoR pay instance

371:04

order let's

371:06

add

371:09

const options and here in this options

371:12

we have to add the order amount so just

371:15

add

371:17

amount and in this amount we will add

371:19

the

371:21

amount we are getting this amount from

371:24

here you can see here we have the amount

371:28

right so after this amount we have to

371:32

add currency and order received but

371:37

before that in this amount we have to

371:38

multiply it with

371:42

100 like this just add comma here we

371:46

have multiplied it with 100 because when

371:48

you

371:50

add like

371:53

this

371:55

$155 then it will be considered as

372:00

$1.55 by Reser pay so to make it 155 we

372:04

have to multiply it with with 100 so it

372:06

will remove the decimal

372:08

point so after this amount we have to

372:11

add the currency so we will add

372:14

currency and in this one we will add the

372:16

currency from the envirment variable so

372:19

just add process

372:21

do

372:23

EnV Dot and let's add the environment

372:27

variable name

372:29

currency after that we have to add the

372:31

reip and the reip will be unique this

372:35

receipt is very important because we

372:37

have to verify the razor pay payment

372:40

later so in this one we have to add the

372:43

unique ID so whenever the transaction

372:46

will be created and stored in the

372:48

database so in this transaction data one

372:51

ID will be created by mongod DV so we

372:55

will use that ID in this recept so just

372:59

add new

373:01

transaction Dot uncore ID that is

373:06

autogenerated by mongod

373:08

DB so now we have this options and this

373:11

options will be used to create the

373:14

orders using this razor pay

373:17

instance right now here either we will

373:20

get the error or order so in this Aro

373:24

function let's add the if

373:29

statement and here we will add error so

373:33

if we get the error then we will

373:37

add console

373:40

log and provide this

373:44

error after that we will add the

373:47

response so just

373:49

add

373:51

return response.

373:54

Json and in this response we will add

373:57

success false and in the message we will

374:00

provide this error that's it suppose

374:03

there is no error then we will will get

374:05

this order right so we have to send one

374:10

response using Json method and in this

374:13

response we will

374:16

add one object and in this object we

374:19

will

374:20

send success

374:22

true and with that we will send this

374:28

order like this so now we have completed

374:32

this controller function that is

374:35

payment Reser pay correct after that we

374:38

have to export this function from this

374:40

file so scroll down and in this export

374:45

let's add the function name payment

374:48

Reserve pay and using this controller

374:50

function we will create the API

374:53

endpoint for that let's open this

374:56

sidebar and we will

374:59

open

375:01

this user routes.js file in this one let

375:06

me duplicate this route this

375:10

one and here we will make it

375:15

post and uh here we will

375:19

add the path so let me add the path

375:23

name pay razor

375:27

pay or let me write pay

375:31

rer after that we need this all Au user

375:35

for user authentication so this Au user

375:38

will add the user ID using the

375:43

token after that we will add the

375:45

controller function so here just add

375:48

this controller

375:51

function payment razor pay so this

375:56

payment Razer pay function has been

375:59

imported from this user controller.js

376:02

file in this line you can see it has

376:04

been imported

376:05

right and here we are using this payment

376:08

Reserve pay controller function and

376:09

before that we are using this middleware

376:12

that will convert the token into user ID

376:17

and here we have used this post

376:20

method so now we have created the API

376:24

endpoint for razor pay payment after

376:28

that we have to link this API endpoint

376:30

with our front end so let me just come

376:35

back and I'll close these files we will

376:39

collapse This Server folder and we will

376:41

open client

376:42

folder and in this one we will go to SRC

376:46

and here we have this pages and we will

376:49

open buy credit. jsx file correct and

376:54

here we have to create the function that

376:58

will initialize the Reser pay payment on

377:01

website but before that let's see the

377:04

res pay documentation so we will come

377:07

back to the Reser pay

377:10

website here it is and in this one we'll

377:13

go to resources and select developer

377:17

docs and in this left side bar just

377:20

click on the

377:22

payments then select payment

377:27

gway and in this one we will open web

377:32

Integrations then click on integration

377:36

steps scroll

377:39

down and in this one you can see here we

377:42

have one

377:43

script this one so we have to copy this

377:47

a script and we will come back to

377:51

the vs code and in this front end folder

377:55

that is the client folder we will

377:59

open

378:01

index.html file and we will paste this

378:03

script here before this closing body tag

378:06

so just paste the script that we have

378:09

copied from Reser pay

378:12

documentation after that let's come back

378:14

to the buy credits. jsx

378:17

file and in this one we need the backend

378:21

URL to make the API call to our API

378:25

endpoint and we also need the token and

378:29

we need the set so login then we need

378:32

the load Credit Data right and we need

378:37

the user so user is already available

378:39

and we are getting it from the context

378:41

so with this user we will get the

378:44

backend URL also from the

378:49

context then we will

378:51

get load credits

378:55

data we will get this function after

378:58

that we need the

379:00

token so that we will send this token in

379:03

the a API request after that we need the

379:07

set so login seter

379:11

function so we will get all these from

379:15

App

379:16

context correct after that we need the

379:20

use navigate hook that will help us to

379:22

navigate the users on homepage after

379:25

making the payment so let me add that

379:27

one also we will add

379:29

const navigate is equal to use navigate

379:35

so use navigate has been imported from

379:37

react router

379:41

Dom after that we have to create one

379:44

function that will be executed whenever

379:47

we will click on the payment button so

379:50

here let's add

379:52

const and we will add the function name

379:55

payment rasor

379:57

pay it will be as synchronous

380:01

function and create this Arrow function

380:06

and in this function we need the plan

380:12

ID correct now here we will add the TR

380:15

catch

380:18

block and in this catch block let's add

380:22

the error in toast notification so we

380:25

will

380:27

add toast so the toast will be imported

380:30

from react toasttify then toast. error

380:35

and in this eror we will add this

380:37

eror do

380:42

message correct now we will add the

380:44

statement in this Tri block so here in

380:48

this Tri block first we will check

380:51

whether we have the user or not so we

380:53

will add

380:55

if and we'll add not of user so if the

380:59

user is not available it means we are

381:01

not logged in then we will open the

381:05

login form for that we will use this set

381:09

so login and we will make it true so it

381:13

will open the login form right now

381:17

suppose the user is already logged in

381:20

then we will simply make the API call to

381:22

the Reser pay API that we have created

381:26

in our back end for that let's add a

381:31

wait and here we will at the exio

381:39

package so it is not available so we

381:41

have to import it so here let's

381:45

add

381:49

import exos from

381:53

exos and here we will use this exos and

381:58

here we will use the post

382:02

method in this one we have to provide

382:05

the backend URL and in this backend URL

382:08

we will concatenate the API end point so

382:13

just add SL API slash

382:17

user

382:19

slash

382:26

payer so we have created this API

382:29

endpoint in our back end correct now

382:33

with this one we have to pass the plan

382:35

ID so we will add the object and provide

382:39

plan ID after that we will add one more

382:42

object and in this one we have to

382:44

provide

382:47

headers and in this headers let's add

382:52

token so our middle bear will get this

382:56

token and find the user

383:00

ID so here we have added the API call to

383:03

our Reser pay payment API end point

383:08

right now we will get the response from

383:10

this API request so here just add

383:16

const data so we will get the response

383:19

in this data and after that we will

383:23

check so here let's add if statement and

383:28

we will add data do success

383:35

so if the data. success is true then it

383:39

will initialize the payment for that we

383:41

have to create one function that will

383:43

initialize the payment so before this

383:47

function let's add another function we

383:50

will

383:51

add

383:53

const and the function name will

383:57

be init

384:01

pay and it will be a synchronous

384:03

function

384:05

and in this one we need the

384:09

order let's add a space here and uh

384:12

create this Arrow

384:17

function correct so we will create this

384:20

init pay function that will initialize

384:24

the

384:25

payment right now we will call this init

384:29

pay function whenever this data do

384:32

success is true so here simply add init

384:37

pay and in this one we will

384:40

add data dot order because in the

384:45

response we will get the

384:47

order correct after that we have to link

384:51

this payment razor pay function with our

384:54

button so that when we click on the

384:56

payment button this function will be

384:58

executed so just copy this function and

385:01

scroll down and here we have this button

385:04

so in this button we will add on click

385:09

property and in this on click we will

385:11

add one Arrow

385:14

function and provide this function that

385:17

we have just created and here we have to

385:19

provide the

385:22

item dot ID that will be the plan

385:28

ID save these

385:30

changes after that scroll up and here we

385:33

have this init pay function so we have

385:36

to add logic in this init pay function

385:40

for that let's come back to the Reser

385:43

pay

385:44

documentation and here you can see we

385:46

have to create this options variable and

385:50

in this options we have to store the key

385:54

that will be the Reser pay key ID

385:57

correct then we have to store other

386:00

information like amount currency name

386:03

description and other details about the

386:07

order right and then we have to add this

386:11

new Reser pay and provide this option

386:15

for that let's come back to the vs code

386:18

and first we have to add the razor pay

386:23

key ID in the front end environment

386:26

variable so let me just copy the

386:29

envirment variable from

386:33

here that is Razor pay key ID just copy

386:37

this

386:38

one and uh let's come back and we will

386:43

open sidebar and here in this client

386:46

folder here we have the environment

386:49

variable where you can see backend URL

386:53

so in this one just provide this razor

386:55

pay key ID our front end is created

386:59

using wheat package so here before this

387:02

variable name we will add whe so it will

387:05

be Vore res pay key ID save the changes

387:10

now let's open by credit. jsx file and

387:14

here we will create the options so we

387:17

will add

387:22

const

387:27

options it will be one object and here

387:31

we have to add the key

387:34

and in this key we will add

387:36

import do

387:39

meta do

387:42

EnV Dot and the envirment variable name

387:47

we Reser pay key

387:49

ID like

387:52

this let's add the comma and here we

387:55

will add the order amount so we will add

388:01

amount and it will be

388:05

order that we are getting in this

388:08

parameter so we will add order do

388:13

amount after that we have to add the

388:16

currency so we will

388:19

add currency and it will be order.

388:25

currency then we need the name so in

388:27

this name let me

388:31

add credits payment because we are

388:34

buying the credits now we have to add

388:38

the description so let's add the comma

388:40

duplicate this line and here we will add

388:44

description so it is also credits

388:48

payment right after that we need the

388:50

order

388:55

ID and in this order ID we will add the

388:59

order that we are getting from this

389:02

parameter and from this we will find the

389:05

ID after that we need the rece so let's

389:11

add receip and we will get it from order

389:16

dot

389:19

receip after that we have to add one

389:22

Handler function so just add Handler we

389:26

are adding Handler and it will be as

389:29

synchronous

389:32

function and create this Aro

389:36

function now in this one we will get the

389:39

response so just add

389:44

response and in this Aro function simply

389:48

console log the response so we will

389:53

add console log and we will print this

389:58

response in the

389:59

console so here we have created this

390:02

options so after this

390:05

options

390:09

here let's

390:12

add

390:14

con razor pay or we can

390:19

write

390:21

rzp equal

390:23

to

390:26

new window Dot

390:35

razor

390:37

pay and here we have to provide this

390:45

option next simply

390:49

add

390:50

rzp do

390:56

open save the

390:58

changes now we have to test this

391:01

functionality so just come back to the

391:04

website and here you can see we have

391:06

different plans so let me click on this

391:09

Advanced click on this purchase

391:12

button so this click is not working so

391:15

let me just come back and we will open

391:18

vs code and open the

391:21

terminal let me go to the backend

391:24

terminal and here we are getting some

391:28

error path is required so

391:34

there is some error in

391:36

the mongod DB model so let's

391:42

open backend

391:45

folder that is server and in this one

391:48

we'll go to models and open transaction

391:50

model and here we have added this plan

391:55

that is the incorrect so just correct

391:58

it plan p n Save the changes and come

392:03

back to theb page again click on this

392:07

button now you can see it is opening a

392:10

window for razor pay payment here it is

392:14

asking for the phone number so let me

392:16

add a dummy phone

392:22

number click on

392:24

continue now here we have to provide the

392:28

card number so before that we will right

392:31

click and select inspect and we will

392:33

open the the console because in this

392:36

console we will get

392:38

the response right let me clear this

392:45

console and we will open a new tab and

392:48

here we will search

392:51

for razor

392:53

pay test card details then open this

392:58

website and here you will get the test

393:01

card numbers so scroll down and and here

393:04

we have this card number and in this one

393:06

we have to provide any random CVB number

393:10

and we can use any future date in the

393:12

expiry date so just copy this card

393:14

number and let's come back and provide

393:17

this card number

393:18

here then provide any future date so

393:22

let's

393:24

add this date then we'll add the CVB

393:29

number and we'll add the name on card so

393:32

let me add great

393:37

tag now just click on this continue

393:40

button here it is asking for the email

393:43

also so let's add any dummy email ID

393:47

test at test.com click on

393:51

continue click on maybe

393:56

later now we are getting the message

393:59

payment cannot be completed it says

394:02

international cards are not supp

394:03

supported please contact our support

394:05

team for help it means there is some

394:08

issue with this card number so let me

394:10

just close

394:11

it and press yes exit and now we will

394:17

try again with different card click on

394:20

the payment button and here let me add

394:22

the another card number this

394:25

one paste it here here we will add any

394:30

date then CBB number and name on card

394:35

then click on continue so it will open

394:38

this page here we can simulate this

394:41

payment either failed or success so let

394:44

me click on this success

394:49

button so now you can see the message

394:52

payment is

394:54

successful and in this console you can

394:56

see we have one response let me zoom

395:00

in and here you can see we have this

395:04

response and in this one we have the

395:06

razor pay order ID razor pay payment ID

395:11

and here we have the Reser pay signature

395:14

so using this response we will verify

395:17

the payment as you can see still the

395:20

credit is zero because we have not

395:22

verified the payment yet so using this

395:24

order details we will verify the payment

395:27

and then we will increase the credit so

395:31

to verify the Reser pay payment we have

395:34

to come back to the VSS code and we will

395:36

come to backend project so let's open

395:40

the sidebar and from here let me close

395:44

all these files here we will go for

395:47

Server folder then we will go for

395:50

controller folder and we will open user

395:53

controller.js file in this file here we

395:57

will create a controller function with

396:01

the name verify razor page so just add

396:05

const verify razor pay and create the as

396:09

synchronous Arrow

396:12

function here we will get the request

396:14

and response in this

396:17

parameter after that we will add the try

396:19

catch block and let me add the code in

396:24

the catch block so here we will add

396:26

console log error and we will send the

396:29

response with success false and the

396:32

message will be error do message message

396:34

so if any error occurs in this Tri block

396:37

this error will be displayed in the

396:40

terminal and we will send the response

396:43

with success false and error message now

396:47

we will add the logic in this Tri block

396:49

so here we have to find the Razor pay

396:52

order ID so we will get the razor pay

396:54

order ID from the razor pay payment

396:59

response right so we will add con

397:03

and here we will add

397:05

the razor pay order

397:09

ID if I come back to the browser you can

397:12

see here we are getting razor pay order

397:14

ID correct so we have to find this one

397:18

and we will get it

397:20

from request do

397:26

body correct after that we will add

397:30

const order info

397:34

and in this order info we will add a

397:37

wait and we will use the razor pay

397:42

instance and in this razor pay instance

397:45

we will add

397:47

orders and we will add

397:50

Fetch and in this fetch we have to

397:53

provide this order

397:58

ID so now we will get the order info now

398:02

from this order in before we have to

398:04

check the status of this order so here

398:07

we will add the if statement and we will

398:11

add order info.

398:14

status and if the status is

398:21

paid so here we will check if the order

398:23

info. status is paid then we have to

398:27

find the transaction data for this order

398:30

so we will add con

398:36

let's add

398:37

the variable name transaction data is

398:41

equal to

398:42

await and we will find the transaction

398:45

data using the transaction model so just

398:48

add transaction model

398:52

dot find by

398:55

ID and in this ID we have to provide the

398:58

order

399:01

info do re

399:06

so if I scroll up you can see here we

399:10

have added this receip and in this reip

399:13

we have added the new transaction ID so

399:17

to find the transaction data we are

399:19

using the transaction model and in this

399:22

we are using find by ID method and we

399:25

are providing the order info do received

399:28

so we will get the transaction data now

399:31

we will check with this transaction data

399:33

so here let's add the if

399:36

statement and here we will

399:38

add if the transaction data do

399:47

payment so we are checking the payment

399:49

property if it is true it means the

399:52

payment is already

399:55

verified if I save the changes and come

399:58

back to the web

399:59

browser and open the mongod DB database

400:02

refresh

400:03

it so here you can see we have one more

400:07

collection called

400:10

transactions if I open it so in this one

400:14

we have these transactions right so in

400:17

these transactions you can see we have

400:19

the payment Falls

400:22

right here also we have the payment

400:24

Falls so whenever we will verify the

400:27

payment we will make it true but here we

400:30

are adding the if statement

400:33

like if the transaction data. payment is

400:36

already true it means the payment is

400:38

already verified so in that case we have

400:41

to return one response so just add

400:46

return response.

400:49

Json and here we will add one object

400:52

with success false and we will add the

400:55

message called payment

400:58

failed so we are sending this response

401:02

payment failed because the payment is

401:03

already

401:05

verified now if the transaction data.

401:08

payment is false so in that case we have

401:12

to add the credit in users account or

401:17

user data so here let's add

401:22

con user

401:24

data and in this user

401:27

data we have to add a wait and we will

401:31

find the user data using user model so

401:34

just add user

401:36

model dot find by ID and

401:43

provide transaction data do user

401:48

ID so we will find the users data now in

401:52

this one we have to find the credit

401:55

balance and we will add the credit so

401:59

here let's add

402:01

const and in this one we will

402:06

add credit balance equal

402:10

to user data

402:14

Dot credit balance

402:18

plus transaction data dot

402:23

credits so it is

402:25

the current available balance of the

402:29

user and this is the credits that is

402:33

purchased using the pricing plan so if I

402:36

come back to the transaction data here

402:39

we have the credits value 500 like that

402:42

correct so here we are adding the

402:44

current balance current credit balance

402:47

and the credit that will be added after

402:50

purchasing the

402:52

plan after that again add

402:55

await and here we will use the user

402:59

model

403:01

dot find by ID ID and update

403:07

method and here we will find the user so

403:12

just

403:13

add user data

403:17

doore

403:19

ID and here we have to update the credit

403:22

balance so let me just copy it and paste

403:25

it here in this

403:27

object so here we have added this new

403:31

credit balance and this new credit

403:32

balance will be updated in the user data

403:36

using this user model so now we have

403:40

updated the credit after purchase right

403:44

next we have to update the payment

403:47

status also so in this transaction data

403:50

you can see we have the payment property

403:52

false so we have to make it true after

403:55

verification so just come back and here

403:58

let's

403:59

add await we will add transac

404:04

model do find by ID and

404:10

update and here we will

404:12

add transaction data doore

404:18

ID and comma we will add cly addes and

404:22

we will

404:24

make

404:26

payment

404:30

true so it will make the payment true

404:33

after that we have to generate one

404:35

response so just add response.

404:38

Json and in this one we will add one

404:41

object with success true and we will add

404:46

message credits

404:49

added that's it now we will add the Elsa

404:52

statement so here we have added the if

404:54

statement so here let's add else

404:57

statement and in this else statement we

404:59

will add the response so we will

405:03

response. Json success Falls and in the

405:07

message we will add payment

405:11

failed this

405:13

one that's it now we have created the

405:17

razor pay payment verification

405:19

controller function Now using this

405:21

controller function we will create one

405:24

API route so let's

405:27

open server folder then open routes

405:31

folder and in this one we have this user

405:35

routes.js file here we will just

405:38

duplicate this line that is user router.

405:41

poost and here we will provide the path

405:44

so in this one we will

405:47

add verify

405:52

razor that means verify razor

405:55

Pay Here we will use

405:57

this controller function that we have

406:00

just created so just add

406:04

verify Razer pay but first we have to

406:07

export it so let me just come back to

406:11

the previous file that is user

406:13

controller and here we have created this

406:15

verify razor pay function and we have to

406:19

export it from this file so here let's

406:22

add the comma and provide the function

406:25

name verify RoR pay that's it now in

406:28

this one we have to import that so here

406:33

in this statement import we will add

406:36

comma verify RoR pay so we have imported

406:40

this verify rer P from user controller

406:42

now here we will provide this controller

406:44

function at this path so now we have

406:47

created the API end point for Reser pay

406:51

payment verification that is verify

406:55

Reser now we have to link this payment

406:59

verification API with our front end so

407:03

let me just close these files and

407:06

collapse this folder and we will open

407:08

client folder then go to SRC then pages

407:11

and

407:12

open by credit. jsx file here we will

407:18

scroll this file and you can see in this

407:20

one we have added one Handler function

407:24

here it is so in this Handler function

407:26

we have added console log so just remove

407:28

it and in this one let's add the TR

407:32

catch block

407:35

block correct now in this catch block we

407:38

will add the error in toast notification

407:42

so we will

407:43

add toast.

407:47

error

407:48

and here we will provide error do

407:55

message correct now we will add the

407:57

logic in this Tri block so in this Tri

408:00

block let's add

408:04

const

408:06

data equal to and we have to make the

408:10

API call to our razor pay verification

408:14

API endpoint so we will add a wait then

408:18

we will use the exuse package for API

408:23

call here we will use the post

408:26

method and in this one we will add the

408:29

backend URL and in this backend URL we

408:32

have have to concatenate the API end

408:35

point so we will add/ API slash

408:41

user slash verify

408:47

deser after that in this one we have to

408:50

send the response which is here so this

408:54

response will be added in this API

408:58

request correct after that we have to

409:00

provide the headers so so just add the

409:03

curly bres we will provide headers and

409:06

in this headers we have to provide the

409:10

token correct after that here we will

409:13

add the if statement and we will check

409:15

the

409:17

response so we are getting the response

409:20

in this

409:22

data so let's add data dot

409:27

success so if the data do success is

409:30

true it means the payment is successful

409:32

verified so after verifying the payment

409:36

we will again load the credit so we will

409:39

add the load Credit Data

409:43

function correct and after that we will

409:46

redirect the user on home page so we

409:49

will use

409:52

navigate and we will provide the Home

409:55

Path after that we will send one

409:59

notification so just

410:01

add toast

410:03

dot success and here we will add the

410:07

message called credit

410:11

added like

410:14

this after adding this if I come back to

410:17

the web page

410:19

again

410:21

and let me close

410:24

this browser

410:26

console and right now you can see the

410:29

credit is zero correct and let me choose

410:33

the first plan which is basic click on

410:35

this purchase button so it should add

410:38

the 100 credit so let me just click

410:42

here here we will add the card number so

410:46

again copy this test card

410:50

number add any future month and

410:54

year CBB number and

410:58

name click on

411:01

continue now just click on this success

411:07

button so now the payment is

411:10

successful and after successful payment

411:13

we are redirected to the homepage and

411:16

here at the bottom right side you can

411:18

see the toast notification called credit

411:21

added correct and in this navigation bar

411:24

you can see the credit left 100 it means

411:27

the credit has been

411:28

added now if I go to mongod DV database

411:32

refresh

411:34

it scroll

411:37

down here still we have the payment

411:41

false so let me just come back

411:45

and we will

411:48

open

411:50

server controller and user controller.js

411:54

file and in this

411:58

one we have

412:00

added payment true

412:03

so let me correct this

412:05

spelling p a y m n t payment true save

412:09

the changes and come back to the web

412:12

browser again and let me make another

412:15

transactions right now you can see the

412:16

credit is 100 correct and now if I want

412:21

to purchase this Advanced plan that

412:23

gives 500 credits so just click on this

412:26

purchase

412:28

button provide the card number

412:33

and other card

412:39

details now click on success

412:45

button now the payment is successful and

412:48

after successful payment we are

412:50

redirected to homepage and you can see

412:53

the notification in the bottom right

412:55

side credit added and you can see the

412:58

updated credit balance which is 600 and

413:02

if I go to database refresh

413:04

it so now we have one new transaction

413:08

data here and in this one you can see

413:09

the payment is true and the credit 500

413:14

so in the last transaction we have

413:17

purchased the advanced plan with 500

413:20

credits and now the payment is true so

413:24

payment is successfully verified and the

413:26

credit has been added here correct now

413:29

we have this credit so we can again just

413:32

generate the images so let me just click

413:35

on this generate image button again so

413:38

it will open this result page and here

413:39

we have to enter the prompt so let me

413:42

add any other prompt so let's add white

413:47

dog playing with birds click on generate

413:54

button now you can see the image

413:57

generated using our prompt and you can

413:59

see the credit balance has been reduced

414:03

by one so this image generator is

414:06

working fine we can create an account on

414:09

this image 5 website we can log to the

414:12

existing account we can log out from the

414:14

account and here we have the credit and

414:17

we can also purchase more credits using

414:20

these plans and for this credit purchase

414:23

we have added the Razer pay payment gway

414:26

and if you want to add the a stripe

414:29

payment gateway then you can check out

414:30

the source code link given in the

414:33

description where I have added both

414:35

razor pay and a

414:36

stripe so finally we have created our

414:40

full stack image generated AI SAS

414:42

application that generates the image

414:44

from text using the AI so I hope this

414:48

video will be helpful for you if you

414:50

have any question you can ask me in the

414:52

comment section please like and share

414:54

this video

UNLOCK MORE

Sign up free to access premium features

INTERACTIVE VIEWER

Watch the video with synced subtitles, adjustable overlay, and full playback control.

SIGN UP FREE TO UNLOCK

AI SUMMARY

Get an instant AI-generated summary of the video content, key points, and takeaways.

SIGN UP FREE TO UNLOCK

TRANSLATE

Translate the transcript to 100+ languages with one click. Download in any format.

SIGN UP FREE TO UNLOCK

MIND MAP

Visualize the transcript as an interactive mind map. Understand structure at a glance.

SIGN UP FREE TO UNLOCK

CHAT WITH TRANSCRIPT

Ask questions about the video content. Get answers powered by AI directly from the transcript.

SIGN UP FREE TO UNLOCK

GET MORE FROM YOUR TRANSCRIPTS

Sign up for free and unlock interactive viewer, AI summaries, translations, mind maps, and more. No credit card required.