Skip to content

Web application for gathering and presenting data about life events of creative persons

License

Notifications You must be signed in to change notification settings

yaskevich/persona

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Persona

a character assumed by an author in a written workMerriam-Webster dictionary

Web application for gathering and presenting data about life events of creative persons

Briefly, it is a CMS for biographies (lists of events classified by activity) of people that are related to other people (persons) and to objects (works) of different types (genres), grouped into collections (books).

Project structure

  • Client application (frontend / UI) code is in front.

  • Server application (backend / API) code is in back.

Both apps are written in modern JavaScript and tested with the latest LTS versions of NodeJS (v14 and v16). The client needs NodeJS to be built into static bundle, the server runs on NodeJS.

Deployment

The example script that gets the code from Github, builds the client app bundle and runs the server is in deploy-persona.sh file. Note: it uses PM2 as a globally installed package, you should install it manually before running the script. Otherwise, you have to modify the code for using nodemon or directly node, but it is not recommended for production.

Client application

It is a JavaScript UI application written with Vue 3 framework and Element Plus component library. Build tool is Vite.

Internationalization

The client application supports localization, currently English and Russian locales are provided. The list of supported languages and corresponding translations of UI texts are stored in i18n.json file. One can easily add a new language, putting new language name to languages array and extending an array of every UI element translation with new item in dictionary object.

Serving client code

At first, install all necessary NodeJS modules: npm install

To build the static bundle run:

npm run build

To start development and run the app in hot-reload mode:

npm run dev

To serve client code locally:

npm run serve

Server application

This is an ExpressJS application that stores data in a database and controls an access to the data with JSON Web Token. User passwords are not stored in the database, just hashes.

The only external dependency of the app is PostgreSQL server v9.6+. Once it is installed and the database is created, you have to provide environmental variables either via .env file, or by putting them in ecosystem.config.cjs, or providing them in other way – it depends on how you are going to deploy the application.

Thus, running with nodemon:

nodemon index.js

With PM2:

pm2 start ecosystem.config.cjs

There is a list of the variables, with example values:

PGUSER=database_user
PGPASSWORD=......
PGDATABASE=database_name
PGPORT=5432
PORT=8080
JWT_SECRET=test

Keep in mind, before running the app one should install all necessary NodeJS modules with npm install

Web-proxy

As a rule, there is more than one application running on a single server, so it is a good practice to set up NodeJS apps so they are covered by frontend web-proxy server such as Apache or Nginx, working on the same IP, but serving different virtual hosts.

For example, running Persona under Nginx would require setting up proxy_pass directive for location like this:

proxy_pass http://127.0.0.1:8080;


Resources

The favicon of the client application was generated via Favicon.io web-service using the following font:

About

Web application for gathering and presenting data about life events of creative persons

Resources

License

Stars

Watchers

Forks