1

I have a question that is crucial for my end of year project.

Background

My web application allows users to build other webapps based on drag&drop (within the domain of the webapp).
These web applications can contain regular elements, but also functional widgets in the form of ReactJS components that can even talk to our backend.
When the user uploads a self-created webapp, they upload the description for a website (*.zp format, which is actually json), which I'll build at the server (meaning, the json file is converted to an actual webpage with css, js properly built).

Here is the scheme for POSTing a single webpage, which I'll explain below:

enter image description here

  1. The user builds a webpage that is transformed into a descriptive json file (*.zp);
  2. The json file is uploaded to the NodeJS server, which builds the HTML (React JS components can be rendered to html at the server), css file (based on self written algorithm) and JS (minified/concatenated).
    It requires conversion logic, and NodeJS child processes to transpile ES6 ReactJS components with webpack too;
  3. HTML, CSS and built (minified/concatenated) JS is sent to the Java Spring REST server to store into the db. Here my plan is to use Java as a simple REST server.

In case you wonder: I use Java Spring because my EOY project is for a Java graduate.

When the user wants to render a webpage, the files can be immediately downloaded from the Java services (which may implement further caching).

I have the following related questions:

  • Do you see loopholes in the architecture that require a fix?
  • I thought storing the html + JS + *.zp (json describing the site) be performed as a transaction in Java. Is this a valid workflow? If so, what is the best way to send the html, css, js and *.zp form the NodeJS to the Java server in a single shot?
  • Do you have any advice related to choice of db? My intention was to use a mix between filesystem and MongoDB for the *.zp format.

I appreciate you help, the answer to this question is very important for me.

  • This is a school project? Very ambitious. What are the grading criteria? – Robert Harvey Jun 26 '16 at 1:45
  • @RobertHarvey This is actually my pet project, but since I decided to finally get a degree in programming (Java), I took the opportunity to use it for my eoy assignment to give myself a deadline (end September). The criteria were that the project should not be too simple, and we were allowed to use different technologies. I'll get some feedback soon, but I'm going to do it anyway. Actually the final purpose is to build a search engine based on an opinionated relational data structure, and optionally big data, but I will work on this next year, if I manage to finish my task this year. – Trace Jun 26 '16 at 9:03
1

If you are using a database which supports transactions, then just upload the components in the same transaction. They won't be visible to the application until the transaction is committed, which will be an atomic event. Search for "database ACID" for more details.

Alternatively, ensure all the resources for the page are in place before adding the HTML component. This may require versioning the components if a page can be updated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.