FCP X must store some essential items in the library. However you can keep everything else outside the library. This includes media files, temp files, render files, analysis files, backup files, etc. Keeping everything outside the library makes the library file itself smaller. OTOH keeping everything inside the library makes it easy to backup or hand off to another editor, since you're confident all items are within that one library.
The location of the library itself is determined when you create it. If you give a different location (say on an external drive vs your SSD drive) it will remember that and all subsequent libraries will be created in that new location.
In general you can work off the external media files on an external drive, and they are usually not duplicated within the library or elsewhere. The exception is AVCHD and Sony XAVC media, which cannot be used "in place". They must be imported either to the library or a designated external location outside the library.
You can easily move a library to a new location by doing it in Finder with FCP X shut down. Here's an article on that:
https://larryjordan.com/articles/fcp-x-move-libraries-events-and-projects/
Media Management Improvements in FCP X (how to control what media goes where):
A good inexpensive tool to manage library space is Final Cut Library Manager. It can quickly and safely clean up lots of space:
http://www.arcticwhiteness.com/finalcutlibrarymanager/
MacBreak Studio discusses Library File Manager: