A database needs to be prepared, and all required dependencies need to be installed, before the project can be successfully run.
First, create a user with the following credentials and permissions:
- Username
familyplanner
- Password
familyplanner
- Able to login
Then, create a database called familyplanner
, owned by the user created previously (also called familyplanner
).
Execute the following SQL to create database table for NLog, change the owner to familyplanner
CREATE TABLE nlogs
(
Id serial primary key,
Application character varying(100) NULL,
Logged text,
Level character varying(100) NULL,
Message character varying(8000) NULL,
Logger character varying(8000) NULL,
Callsite character varying(8000) NULL,
Exception character varying(8000) NULL
)
dotnet tool restore
npm install
dotnet restore
dotnet ef database update
dotnet user-secrets set "ImgBB_API_Key" "YOUR API KEY"
dotnet user-secrets set "JWT_Secret" "YOUR SECRET"
dotnet user-secrets set "SendGrid_API_Key" "YOUR API KEY"
dotnet user-secrets set "SendGrid_Email" "Sender Email Address"
dotnet user-secrets set "OpenAI_API_Key" "YOUR API KEY"
dotnet user-secrets set "ConnectionStrings_DefaultConnection" "Host=localhost; Port=5432; Database=familyplanner; Username=familyplanner; Password=familyplanner"
dotnet user-secrets set "JWT_AppName" "AppName"
dotnet user-secrets set "JWT_Issuer" "Issuer"
dotnet user-secrets set "JWT_Audience" "Audience"
dotnet user-secrets set "JWT_RefreshTokenName" "RefreshTokenName"
dotnet user-secrets set "ImgBB_API_Key" "YOUR API KEY"
dotnet user-secrets set "DB_CONNECTION_STRING" "Host=localhost; Port=5432; Database=familyplanner; Username=familyplanner; Password=familyplanner; <other setting such as SSL>"
create a .env file by referring to .env.template
npm install
To run the project locally, the backend and frontend should be started separately.
dotnet watch run
npm start
After changing any Models/Data
dotnet ef migrations add <YOUR MIGRATION NAME HERE>
dotnet ef database update
This project requires the following environment variables to be set in the production environment:
ConnectionStrings_DefaultConnection
: connection strings to the database Example:Host=<host>; Port=<port>; Database=<database name>; Username=<database usename>; Password=<passowrd>
SendGrid_Email
: sender email address for sending email to usersSendGrid_API_Key
: API Key for using SendGridOpenAI_API_Key
: API Key for using OpenAIImgBB_API_Key
: API Key for using ImgBBJWT_Issuer
: JWT Issuer Example:http://localhost:5107
JWT_Audience
: JWT Audience Example:http://localhost:3000
JWT_AppName
: JWT AppName Example:FamilyMealPlanner
JWT_RefreshTokenName
: JWT Refresh Token Name Example:FMPToken
JWT_Secret
: JWT Secret Example:dummy-jwt-secret-xxxxxxxxxxxxxxx